<template>
	<view :class="{ white: !colorStyle, black: colorStyle }" @touchmove="handletouchmove" @touchstart="handletouchstart"
		@touchend="handletouchend">
		<view :class="lang">
			<u-navbar :is-fixed="true" :title="$t('indexs.精选500')" back-icon-name="arrow-left" :background="background"
				:title-color="titlecolor" :back-icon-color="titlecolor">
				<view class="slot-wrap">
					<view class="navbar-right">
						<view class="message-box right-item" @click="settings()">
							<image class="settingimg"
								v-bind:src="colorStyle == true ? 'https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/settinga.png' : 'https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/setting.png'">
							</image>
						</view>
					</view>
				</view>
			</u-navbar>
			<scroll-view class="scroll-Ys" scroll-y="true">
				<!-- <view class="mheight" :animation="animationData" @touchstart="touchstart" @touchend="touchend"> -->
				<view class="mheight">
					<view class="topic" :class="lang + 'layout'">
						<view class="topiccon" v-bind:style="{ fontSize: fontSize + 'rpx' }">
							<view class="topiccon-box" :class="{ bgback: colorStyle == true }">
								<view class="topicnum-clear">
									<view class="topicnum">
										<text
											class="topicnum-blue">{{ viewsindex + 1 }}/</text><text>{{ datacount }}</text>
									</view>
									<view class="clear" @click="clearindex()">
										{{ $t("parctices.清理记录") }}
									</view>
								</view>
								<view v-if="lang == 'cn'" class="question-class">
									<text class="question-class-text" v-if="subarr.ttype == 0">{{ $t("keeping.判断") }}
									</text>
									<text class="question-class-text" v-if="subarr.ttype == 1">{{ $t("keeping.单选") }}
									</text>
									<text class="question-class-text" v-if="subarr.ttype == 2">{{ $t("keeping.多选") }}
									</text>
									<text class="" style="line-height: 55rpx; margin-left: 20rpx">
										{{ subarr.question == undefined ? "" : subarr.question }}
										<text class="viewid">ID:{{ subarr.tid }}/{{subarr.year}}</text>
									</text>
								</view>
								<view v-else class="question-class">
									<text class="ku-question-class-text" v-if="subarr.ttype == 0">{{ $t("keeping.判断") }}
									</text>
									<text class="ku-question-class-text" v-if="subarr.ttype == 1">{{ $t("keeping.单选") }}
									</text>
									<text class="ku-question-class-text" v-if="subarr.ttype == 2">{{ $t("keeping.多选") }}
									</text>
									<text class="" style="line-height: 55rpx; margin-left: 20rpx">
										{{ subarr.question == undefined ? "" : subarr.question }}<text class="viewid"
											style="margin-right: 20rpx">ID:{{ subarr.tid }}/{{subarr.year}}</text>
									</text>
								</view>

								<view class="timg" v-if="subarr.timg !== ''" @click="handleImgBig(tiimg)">
									<image :src="tiimg" mode="aspectFit" @error="onimgerr()"></image>
								</view>
								<view class="answer-box" style="margin-top: 41rpx">
									<view v-if="subarr.ttype == 0">
										<view class="answers" :class="jawapjudge[0]" @click="chackjudge('对')">
											<view class="answerselect">
												<view class="answerabcd lineheihtnocn"
													:class="{lineheihtnocn:lang != 'cn'}"
													v-bind:style="{  width: fontSize + 20 + 'rpx', height: fontSize + 20 + 'rpx' ,lineHeight: 50 + 'rpx' }">
													<text v-if="dbjawap != '对' && jawapjudge[0] == ''"
														style="top: 4rpx">A</text>
													<u-icon v-if="dbjawap == '对' && jawapjudge[0] == 'anschack 1'"
														name="checkmark"></u-icon>
													<u-icon v-if="dbjawap == '对' && jawapjudge[0] == 'anschack'"
														name="checkmark"></u-icon>
													<u-icon v-if="jawapjudge[0] == 'wrong'" style="top: 2px;"
														name="close"></u-icon>
												</view>
											</view>
											<view class="answerstext">
												<text>{{ $t("keeping.对") }}</text>
											</view>
										</view>
										<view class="answers" :class="jawapjudge[1]" @click="chackjudge('错')">
											<view class="answerselect">
												<view class="answerabcd" :class="{lineheihtnocn:lang != 'cn'}"
													v-bind:style="{ width: fontSize + 20 + 'rpx', height: fontSize + 20 + 'rpx' ,lineHeight: 50 + 'rpx'  }">
													<text v-if="dbjawap != '错' && jawapjudge[1] == ''"
														style="top: 4rpx">B</text>
													<u-icon v-if="dbjawap == '错' && jawapjudge[1] == 'anschack 1'"
														name="checkmark"></u-icon>
													<u-icon v-if="dbjawap == '错' && jawapjudge[1] == 'anschack'"
														name="checkmark"></u-icon>
													<u-icon v-if="jawapjudge[1] == 'wrong'" name="close"></u-icon>
												</view>
											</view>
											<view class="answerstext">
												<text>{{ $t("keeping.错") }}</text>
											</view>
										</view>
									</view>
									<view v-if="subarr.ttype == 1">
										<view class="answers" :class="jawap[0]" @click="chack('A')">
											<view class="answerselect">
												<view class="answerabcd"
													v-bind:style="{ width: fontSize + 20 + 'rpx', height: fontSize + 20 + 'rpx', lineHeight: 50 + 'rpx' }">
													<text v-if="dbjawap != 'A' && jawap[0] == ''">A</text>
													<u-icon v-if="dbjawap == 'A' && jawap[0] == 'anschack 1'"
														name="checkmark"></u-icon>
													<u-icon v-if="dbjawap == 'A' && jawap[0] == 'anschack'"
														name="checkmark"></u-icon>
													<u-icon v-if="jawap[0] == 'wrong'" name="close"></u-icon>
												</view>
											</view>
											<view class="answerstext">
												<text>{{ subarr.option1 }}</text>
											</view>
										</view>

										<view class="answers" :class="jawap[1]" @click="chack('B')">
											<view class="answerselect">
												<view class="answerabcd"
													v-bind:style="{ width: fontSize + 20 + 'rpx', height: fontSize + 20 + 'rpx', lineHeight: 50 + 'rpx' }">
													<text v-if="dbjawap != 'B' && jawap[1] == ''">B</text>
													<u-icon v-if="dbjawap == 'B' && jawap[1] == 'anschack 1'"
														name="checkmark"></u-icon>
													<u-icon v-if="dbjawap == 'B' && jawap[1] == 'anschack'"
														name="checkmark"></u-icon>
													<u-icon v-if="jawap[1] == 'wrong'" name="close"></u-icon>
												</view>
											</view>
											<view class="answerstext">
												<text>{{ subarr.option2 }}</text>
											</view>
										</view>
										<view class="answers" :class="jawap[2]" @click="chack('C')">
											<view class="answerselect">
												<view class="answerabcd"
													v-bind:style="{ width: fontSize + 20 + 'rpx', height: fontSize + 20 + 'rpx', lineHeight: 50 + 'rpx' }">
													<text v-if="dbjawap != 'C' && jawap[2] == ''">C</text>
													<u-icon v-if="dbjawap == 'C' && jawap[2] == 'anschack 1'"
														name="checkmark"></u-icon>
													<u-icon v-if="dbjawap == 'C' && jawap[2] == 'anschack'"
														name="checkmark"></u-icon>
													<u-icon v-if="jawap[2] == 'wrong'" name="close"></u-icon>
												</view>
											</view>
											<view class="answerstext">
												<text>{{ subarr.option3 }}</text>
											</view>
										</view>
										<view class="answers" :class="jawap[3]" @click="chack('D')">
											<view class="answerselect">
												<view class="answerabcd"
													v-bind:style="{ width: fontSize + 20 + 'rpx', height: fontSize + 20 + 'rpx', lineHeight: 50 + 'rpx' }">
													<text v-if="dbjawap != 'D' && jawap[3] == ''">D</text>
													<!-- <text v-if="dbjawap == 'D' && jawap[3] == 'anschack 1'">D</text> -->
													<u-icon v-if="dbjawap == 'D' && jawap[3] == 'anschack 1'"
														name="checkmark"></u-icon>
													<u-icon v-if="dbjawap == 'D' && jawap[3] == 'anschack'"
														name="checkmark"></u-icon>
													<u-icon v-if="jawap[3] == 'wrong'" name="close"></u-icon>
												</view>
											</view>
											<view class="answerstext">
												<text>{{ subarr.option4 }}</text>
											</view>
										</view>
									</view>

									<view v-if="subarr.ttype == 2">
										<view class="answers" :class="jawap[0]" @click="chackduo('A')">
											<view class="answerselect">
												<view class="answerabcd"
													:class="answers.indexOf('A') !== -1 ? 'abdborder' : ''"
													v-bind:style="{ width: fontSize + 20 + 'rpx', height: fontSize + 20 + 'rpx', lineHeight: 44 + 'rpx' }">
													<text v-if="jawap[0] == ''">A</text>
													<text v-if="jawap[0] == 'anschack 1'">A</text>
													<u-icon v-if="jawap[0] == 'anschack'" name="checkmark"></u-icon>
													<u-icon v-if="jawap[0] == 'wrong'" name="close"></u-icon>
												</view>
											</view>
											<view class="answerstext">
												<text>{{ subarr.option1 }}</text>
											</view>
										</view>

										<view class="answers" :class="jawap[1]" @click="chackduo('B')">
											<view class="answerselect">
												<view class="answerabcd"
													:class="answers.indexOf('B') !== -1 ? 'abdborder' : ''"
													v-bind:style="{ width: fontSize + 20 + 'rpx', height: fontSize + 20 + 'rpx', lineHeight: 50 + 'rpx' }">
													<text v-if="jawap[1] == ''">B</text>
													<text v-if="jawap[1] == 'anschack 1'">B</text>
													<u-icon v-if="jawap[1] == 'anschack'" name="checkmark"></u-icon>
													<u-icon v-if="jawap[1] == 'wrong'" name="close"></u-icon>
												</view>
											</view>
											<view class="answerstext">
												<text>{{ subarr.option2 }}</text>
											</view>
										</view>
										<view class="answers" :class="jawap[2]" @click="chackduo('C')">
											<view class="answerselect">
												<view class="answerabcd"
													:class="answers.indexOf('C') !== -1 ? 'abdborder' : ''"
													v-bind:style="{ width: fontSize + 20 + 'rpx', height: fontSize + 20 + 'rpx', lineHeight: 50 + 'rpx' }">
													<text v-if="jawap[2] == ''">C</text>
													<text v-if="jawap[2] == 'anschack 1'">C</text>
													<u-icon v-if="jawap[2] == 'anschack'" name="checkmark"></u-icon>
													<u-icon v-if="jawap[2] == 'wrong'" name="close"></u-icon>
												</view>
											</view>
											<view class="answerstext">
												<text>{{ subarr.option3 }}</text>
											</view>
										</view>
										<view class="answers" v-if="subarr.option4 != ''" :class="jawap[3]"
											@click="chackduo('D')">
											<view class="answerselect">
												<view class="answerabcd"
													:class="answers.indexOf('D') !== -1 ? 'abdborder' : ''"
													v-bind:style="{ width: fontSize + 20 + 'rpx', height: fontSize + 20 + 'rpx', lineHeight: 50 + 'rpx' }">
													<text v-if="jawap[3] == ''">D</text>
													<text v-if="jawap[3] == 'anschack 1'">D</text>
													<u-icon v-if="jawap[3] == 'anschack'" name="checkmark"></u-icon>
													<u-icon v-if="jawap[3] == 'wrong'" name="close"></u-icon>
												</view>
											</view>
											<view class="answerstext">
												<text>{{ subarr.option4 }}</text>
											</view>
										</view>
										<!-- v-if="subarr.useranswer == null" -->
										<view class="queding" >
											<button class="duoqueding" @click="duoque()">{{ $t("keeping.确定") }}</button>
										</view>
									</view>

								</view>




								<view class="collect-listen-read">
									<view class="collect" @click="collects()">
										<image v-if="!star" class="collect-img"
											src="@/static/images/sc.png">
										</image>
										<image v-else class="collect-img"
											src="@/static/images/sced.png">
										</image>
										<view v-if="!star" class="collect-text">
											<text>{{ $t("keeping.收藏") }}</text>
										</view>
										<view v-else class="collect-text">
											<text>{{ $t("keeping.已收藏") }}</text>
										</view>
									</view>
									<view class="collect" @click.stop="btnBackMusicType('jq',subarr.tid)">
										<image class="collect-img"
											src="@/static/images/tjq.png">
										</image>
										<view class="collect-text">
											<text>{{ $t("keeping.听技巧") }}</text>
										</view>
									</view>
									<view class="collect" @click.stop="btnBackMusicType('yuyin',subarr.tid)">
										<image class="collect-img"
											src="@/static/images/dt.png">
										</image>
										<view class="collect-text">
											<text>{{ $t("keeping.读题") }}</text>
										</view>
									</view>
								</view>

								<view class="answer-correction" v-if="dbjawap">
									<view class="answer">
										<text>{{ $t("parctices.答案") }}</text>
										<text v-if="subarr.ttype == 0">
											<text v-if="lang == 'cn'"
												class="answer-blue">{{ subarr.answer == '对' ?  $t("keeping.对") : $t("keeping.错")  }}</text>
											<text v-else class="answer-blue"
												style="margin-right: 17rpx">{{subarr.answer == '对' ?  $t("keeping.对") : $t("keeping.错")  }}</text>
										</text>

										<text v-else>
											<text v-if="lang == 'cn'" class="answer-blue">{{ subarr.answer  }}</text>
											<text v-else class="answer-blue"
												style="margin-right: 17rpx">{{subarr.answer }}</text>

										</text>
									</view>
									<view class="correction" @click="feed()">
										{{ $t("parctices.纠错") }}
									</view>
								</view>
							</view>


							<view class="Problem-technique" :class="{ bgback: colorStyle == true }"
								v-if="dbjawap && subarr.chapter">
								<view v-if="lang == 'cn'" class="Problem-title">
									<text class="shu"></text>
									<text style="margin-left: 12rpx">{{ $t("parctices.题目技巧") }}</text>
								</view>
								<view v-else class="Problem-title">
									<text class="shu"></text>
									<text style="margin-right: 26rpx">{{ $t("parctices.题目技巧") }}</text>
								</view>
								<view class="technique">
									<!-- <v-html>{{subarr.chapter}}</v-html> -->

									<rich-text type="text" :nodes="subarr.chapter"></rich-text>
								</view>
							</view>



							<view class="Problem-desc Problem-technique" :class="{ bgback: colorStyle == true }"
								v-if="dbjawap && subarr.tdesc">
								<view v-if="lang == 'cn'" class="Problem-title">
									<text class="shu"></text>
									<text style="margin-left: 12rpx">{{ $t("parctices.题目详解") }}</text>
								</view>
								<view v-else class="Problem-title">
									<text class="shu"></text>
									<text style="margin-right: 26rpx">{{ $t("parctices.题目详解") }}</text>
								</view>
								<view class="technique">
									<text>{{ subarr.tdesc }}</text>
								</view>
							</view>
							<view class="Problem-desc Problem-technique" :class="{ bgback: colorStyle == true }"
								v-if="dbjawap && videoVisible">
								<view v-if="lang == 'cn'" class="Problem-title">
									<text class="shu"></text>
									<text style="margin-left: 12rpx">{{ $t("parctices.视频讲解") }}</text>
								</view>
								<view v-else class="Problem-title">
									<text class="shu"></text>
									<text style="margin-right: 26rpx">{{ $t("parctices.视频讲解") }}</text>
								</view>

								<view v-if="videoimgvisible" class="videoimg" @click="handlevideoBox">
									<image lazy-load="true" :src="videoFM"></image>
									<view class="videocount" style="direction: ltr;">
										<u-icon name="play-right" color="#FFFFFF"></u-icon>
									</view>
								</view>

							</view>
						</view>
					</view>

					<!-- 底部上下题切换 -->
					<view class="clearfloat"></view>
				</view>
			</scroll-view>

			<view class="marfoot">
				<view class="markfoot">
					<view class="markfoot-last" @click="privet(1)">
						<image class="last-img"
							src="@/static/images/last.png">
						</image>
						<view class="last-text">
							<text>{{ $t("parctices.上一题") }}</text>
						</view>
					</view>
					<view class="markfoot-right" @click="datika()">
						<image class="right-img"
							src="@/static/images/duigreen.png">
						</image>
						<view class="right-text">
							<text>{{ twracount }}</text>
						</view>
					</view>
					<view class="markfoot-jiangjie" @click.stop="btnBackMusicType('jieshi',subarr.tid)">
						<image class="jiangjie-img"
							src="@/static/images/jqjj.png">
						</image>
						<view class="jiangjie-text">
							<text>{{$t("keeping.官方解释")}}</text>
						</view>
					</view>
					<view class="markfoot-right wrong" @click="datika()">
						<image class="right-img"
							src="@/static/images/wrong.png">
						</image>
						<view class="right-text">
							<text>{{ hatecount }}</text>
						</view>
					</view>
					<view class="markfoot-last next" @click="nextt(1)">
						<view class="last-text">
							<text>{{ $t("parctices.下一题") }}</text>
						</view>
						<image class="last-img"
							src="@/static/images/next.png">
						</image>
					</view>
				</view>
			</view>

			<!-- 答题卡 -->
			<u-popup v-model="showcart" class="popup" mode="bottom" height="700rpx">
				<view style="height: 100%; background-color: #ffffff;">
					<view class="carttitle">
						<view class="carttitleview">
							<text>{{ $t("parctices.答题卡") }}</text>
						</view>
						<view class="carttitleview">
							<view class="markfootview grenn">
								<u-icon top="1" name="checkmark-circle-fill" color="#00B800" size="35"></u-icon>
								<text class="pl-10 grenntext">{{ twracount }}</text>
							</view>
							<view class="markfootview pl-20"></view>
							<view class="markfootview error">
								<u-icon top="1" name="close-circle-fill" color="#E70F43" size="35"></u-icon>
								<text class="pl-10 redtext">{{ hatecount }}</text>
							</view>
						</view>
						<view class="carttitleview">
							<text>{{ twracount + hatecount }}/{{ datacount }}</text>
						</view>
					</view>
					<view class="cartcon">
						<!-- <scroll-view scroll-y="true" class="scroll-Y" show-scrollbar="true"> -->
						<view scroll-y="true" class="scroll-Y" show-scrollbar="true">
							<view class="cartconview">
								<block v-for="(item, index) in subarrid" :key="index">
									<view class="cartconnum cartblue" v-if="item.twrahate == 1" @click="tiao(index)">
										{{ index + 1 }}
									</view>
									<view class="cartconnum cartpink" v-if="item.twrahate == 0" @click="tiao(index)">
										{{ index + 1 }}
									</view>
									<view class="cartconnum" v-if="item.twrahate == 2"
										:class="index == viewsindex ? 'cartaction' : ' '" @click="tiao(index)">
										{{ index + 1 }}
									</view>
								</block>
							</view>
						</view>
					</view>
				</view>
			</u-popup>

			<!-- 设置框 -->
			<u-popup v-model="show" class="popup" border-radius="15" mode="bottom" length="55%" :closeable="closeable"
				:close-icon-pos="closeIconPos">
				<!-- 	<view>
					<view class="poptitle">
						<view class="settingtitle font-35">
							<text>{{ $t('parctices.设置') }}</text>
						</view>
					</view>
					<view class="settingcon pt50" :class="lang + 'layout'">
						<view class="settingcontxt">
							<text>{{ $t('parctices.答题音效提示') }}</text>
						</view>
						<view class="settingswith">
							<u-switch active-color="#07BB07" @change="musicbar" size="40" v-model="musicchecked">
							</u-switch>
						</view>
					</view>
					<view class="settingcon p-t20" :class="lang + 'layout'">
						<view class="settingcontxt">
							<text>{{ $t('parctices.答题震动提示') }}</text>
						</view>
						<view class="settingswith">
							<u-switch active-color="#07BB07" @change="vibrate" size="40" v-model="zhenchecked">
							</u-switch>
						</view>
					</view>
					<view class="settingcon p-t20" :class="lang + 'layout'">
						<view class="settingcontxt">
							<text>{{ $t('parctices.答对自动下一题') }}</text>
						</view>
						<view class="settingswith">
							<u-switch active-color="#07BB07" @change="marknext" size="40" v-model="nextchecked">
							</u-switch>
						</view>
					</view>
					
					<view class="fontsizes">
						<view class="fontsizeleft font-18">A</view>
						<view class="fontsizebg">
							<slider class="fontslider" min="30" max="40" v-bind:value="fontSize" @change="sliderChange"
								activeColor="#C6C7C6" backgroundColor="#C6C7C6" block-size="20" />
						</view>
						<view class="fontsizeleft font-35">A</view>
					</view>
					<view class="settingfoot">
						<view class="settingfoottext">
							<text>{{ $t('parctices.模式') }}</text>
						</view>
						<button class="settingfootbu black font-25" @click="colour(0)">
							<view class="settingfootbutext">
								<text>{{ $t('parctices.夜间模式') }}</text>
							</view>
							<image src="../../static/icon/atnight.png"></image>
						</button>
						<button type="default" class="settingfootbu white font-25" @click="colour(1)">
							<text>{{ $t('parctices.白天模式') }}</text>
							<image src="../../static/icon/day.png"></image>
						</button>
					</view>
				</view>
 -->
				<view style="height: 100%; background-color: #ffffff;">
					<view class="poptitle">
						<view class="settingtitle font-35">
							<text>{{ $t("parctices.设置") }}</text>
						</view>
					</view>

					<view class="setting-yx settingcon">
						<view class="setting-yx-text">
							{{ $t("parctices.答题音效提示") }}
						</view>
						<view class="settingswith">
							<u-switch active-color="#0DA0FF" @change="musicbar" size="43" v-model="musicchecked">
							</u-switch>
						</view>
					</view>
					<view class="setting-yx settingcon booter-bottom">
						<view class="setting-yx-text">
							{{ $t("parctices.答题震动提示") }}
						</view>
						<view class="settingswith">
							<u-switch active-color="#0DA0FF" @change="vibrate" size="43" v-model="zhenchecked">
							</u-switch>
						</view>
					</view>
					<view class="setting-yx settingcon booter-bottom">
						<view class="setting-yx-text">
							{{ $t("parctices.答对自动下一题") }}
						</view>
						<view class="settingswith">
							<u-switch active-color="#0DA0FF" @change="marknext" size="43" v-model="nextchecked">
							</u-switch>
						</view>
					</view>
					<view class="setting-yx booter-bottom">
						<view class="setting-fontsize-text">
							{{ $t("parctices.字体大小") }}
						</view>
						<view class="">
							<view class="fontsizeleft font-18">A</view>
							<view class="fontsizebg">
								<slider class="fontslider" min="30" max="40" v-bind:value="fontSize"
									@change="sliderChange" activeColor="#C6C7C6" backgroundColor="#C6C7C6"
									block-size="20" />
							</view>
							<view class="fontsizeleft font-35">A</view>
						</view>
					</view>
					<view class="settingcon">
						<view class="settingfoottext">{{ $t("parctices.皮肤模式") }}</view>
						<button class="settingfootbu blacks font-25" @click="colour(0)">
							<view class="settingfootbutext">{{ $t("parctices.夜间模式") }}</view>
						</button>
						<button class="settingfootbu whites font-25" @click="colour(1)">
							<text>{{ $t("parctices.白天模式") }}</text>
						</button>
					</view>
				</view>
			</u-popup>

			<u-popup class="imgpop" v-model="imgmodalBox" mode="center" width="100%" height="100%">
				<view
					style="height: 100%; display: flex;flex-direction: column;justify-content: center;align-items: center;">
					<image :src="tiimg" mode="widthFix" style="width: 730rpx;"></image>
					<u-icon name="close-circle" color="#999999" size="56" @click="handleCloseimg"
						style="margin-top: 50rpx;"></u-icon>
				</view>
			</u-popup>


			<u-popup :custom-style='{background:"transparent"}' class="imgpop" v-model="videoboxviible" mode="center"
				width="100%" height="100%" :mask="false" :duration="0">
				<view
					style="height: 100%; display: flex;flex-direction: column;justify-content: flex-end;align-items: center; ">
					<!-- #ifdef MP-WEIXIN -->
					<view
						style="position: absolute; bottom :300rpx;width: 690rpx; overflow: hidden; border-radius: 40rpx;">
						<video id="myVideo" :src="videoUrl" style="width: 690rpx; height: 388rpx;" objectFit="contain"
							controls="true" @error="handleVideo"></video>
					</view>
					<!-- #endif -->
					<!-- #ifdef APP-PLUS -->
					<video style="width: 345px;height: 194px;" id="myVideo" :src="videoUrl" objectFit="contain"
						controls="true" @error="handleVideo"></video>
					<!-- #endif -->

					<view class=""
						style=" margin: 210rpx 0; padding:0 20rpx; height: 80rpx; color: white; background-color:red;border-radius: 50rpx;text-align: center; line-height: 80rpx;"
						@click="handleClosevideo">
						{{ $t("parctices.点击关闭视频") }}
					</view>
				</view>
			</u-popup>


		</view>
	</view>
</template>

<script>
	var graceRichText = require("../../static/richText.js");
	const innerAudioContextbb = uni.createInnerAudioContext();
	//#ifdef APP-PLUS
	import {
		isOpen,
		openDb,
		addTab,
		mergeSql,
		getDataList,
		addTabItem,
		closeSQL,
		deleteInformationType,
		getTable,
		getCount,
		updateSQL,
		isTable,
		selectDataList
	} from "@/js_sdk/lyz-sqlite/index.js";
	import {
		getFileName,
		getimgname
	} from "../../common/imgtool.js";
	//#endif

	//接口
	import {
		tikuindex_api, //题库顺序联系
		cuotilist_api, //错题收藏列表id
		upurl,
		yunurl,
		alldelshoucang_api,
		shoucang_api,
		jingxuan_api, //收藏
		tikutid_api
	} from "@/api/index";

	import {
		getCarType,
		getArrEqual,
		getArrload,
		getArrloads
	} from "../../common/savetool.js";
	const inAudioContext = uni.createInnerAudioContext();
	export default {
		data() {
			return {
				lang: this.$i18n.locale,
				//左右滑动监听
				flag: 0, //1向左滑动,2向右滑动,3向上滑动 4向下滑动
				lastX: 0,
				lastXX: 0,

				rightSlot: true,
				fontSize: 33,
				//设置弹出框
				show: false,
				closeable: true,
				closeIconPos: "top-right",
				//背景音乐
				musicchecked: true,
				zhenchecked: false, //是否打开震动
				nextchecked: true, //自动跳转下一题
				colorStyle: false, //true:夜间模式，false:日间
				// background: '#ffffff',
				background: {
					backgroundColor: "#ffffff",
				},
				titlecolor: "#ffffff",
				showcart: false, //答题卡弹出框
				langheight: 20,

				//获取数据库数量
				datacount: 0,
				subject: "C1C2C3", //科目
				subarrid: [], //题id
				subarr: {},
				viewsindex: 0, //已经看完的题
				kemu: 1,
				lolang: this.$i18n.locale,
				jsonplus: false,
				storageindex: -1, //存储引导id
				storagearr: [],
				star: 0,
				jawap: ["", "", "", ""],
				jawapjudge: ["", ""],
				dbjawap: "",
				worngly: false,
				answers: [], //选择的多选题
				twracount: 0,
				hatecount: 0,
				tiimg: "",
				jin: false, //动画特效开光
				classz: "tanchu", //动画样式
				kumusane: 0,
				zzlx: 0,
				hatelist: [], //错误的科目，别的一律算正确
				minijawap: [],
				musicShow: true,
				animationData: {},
				duration: 500,
				timuList: [],

				year: "2022",
				videoVisible: false,
				videoUrl: "",
				imgmodalBox: false,

				videoimgvisible: true,
				videoboxviible: false,
				videoFM: "../../static/images/videoimgcn.png",
			};
		},
		onUnload() {},
		onBackPress(options) {
			var that = this;
			console.log("返回键");
			this.videoContext = uni.createVideoContext("myVideo");
			this.videoContext.pause();
			//that.fanhui();
		},
		//页面准备好时创建video
		onReady: function(res) {
			this.videoContext = uni.createVideoContext("myVideo");
		},

		//离开页面时暂停视频播放
		onHide() {
			this.videoContext.pause();
		},
		onLoad(options) {
			console.log("options//////////////", options)
			this.videoContext = uni.createVideoContext("myVideo");
			this.videoContext.pause();

			var that = this;

			var kemu = options.kemu;
			that.kemu = kemu;
			console.log("mini_sane", options);
			that.kumusane = options.kemusane;
			// that.datacount = options.kemusane;

			var zhengjiantype = uni.getStorageSync("exam_type");

			if (zhengjiantype == "jiashizheng") {
				that.zzlx = 0;
			} else {
				that.zzlx = 1;
			}

			// that.zzlx = options.zzlx;

			var localcarttype = uni.getStorageSync("cart_type");
			var subjectname = getCarType(localcarttype);
			that.subject = subjectname;

			// uni.getStorage({
			// 	key: 'cart_type',
			// 	success: function(res) {
			// 		console.log(res, '=====');
			// 		console.log(res.data);
			// 		console.log('getCarType--=', getCarType(res.data));
			// 		that.subject = getCarType(res.data);
			// 	}
			// });
			var langstr = uni.getStorageSync("lang_key");
			that.$i18n.locale = langstr;
			that.lang = langstr;
			if (langstr == "cn") {
				that.lolang = "CN";
				that.videoFM = "../../static/images/videoimgcn.png"
			}
			if (langstr == "uy") {
				that.lolang = "UG";
				that.videoFM = "../../static/images/videoimgun.png"
			}
			if (langstr == "kz") {
				that.lolang = "KAZ";
				that.videoFM = "../../static/images/videoimgkn.png"
			}
			if (langstr == "cn") {
				that.langheight = 20;
			} else {
				that.langheight = 38;
			}

			// 题库年份
			uni.getStorage({
				key: "year_key",
				success: function(res) {
					console.log("年份", res.data);
					that.year = res.data;
				},
				fail() {
					that.$u.route({
						url: "pages/setting/setting",
						params: {},
					});
				},
			});


			// 注释1
			// // #ifdef APP-PLUS
			// // uni.showLoading({
			// // 	title: "加载中...",
			// // 	mask: true,
			// // });
			// if (isOpen("data")) {
			// 	//数据库已打开
			// 	console.log("数据库已打开");
			// 	that.dbcount(kemu);
			// } else {
			// 	//数据库没有打开  先打开
			// 	console.log("数据库未打开");
			// 	that.openDb();
			// }
			// // #endif

			// uni.showLoading({
			// 	title: "加载中...",
			// 	mask: true,
			// });
			that.hatekemu(kemu);
			that.minidbcount(options.kemusane);


			//演示使用
			if (options.showcart == "true") {
				that.showcart = true;
			}
			if (options.show == "true") {
				that.show = true;
			}
			//演示结束
			if (that.colorStyle == true) {
				that.background.backgroundColor = "#2d2d2d";
				that.titlecolor = "#888888";
			} else {
				that.background.backgroundColor = "#ffffff";
				that.titlecolor = "#2d2d2d";
			}
			//先查找字体保存情况  如果有存储 直接使用
			uni.getStorage({
				key: "fontsize",
				success: function(res) {
					//console.log(res.data);
					that.fontSize = res.data;
				},
			});
			uni.getStorage({
				key: "musicbars",
				success: function(res) {
					//console.log(res.data);
					that.musicchecked = res.data;
				},
			});
			uni.getStorage({
				key: "vibratebars",
				success: function(res) {
					that.zhenchecked = res.data;
				},
			});
			uni.getStorage({
				key: "nextbars",
				success: function(res) {
					that.nextchecked = res.data;
				},
			});
			uni.getStorage({
				key: "colorStyle",
				success: function(res) {
					that.colorStyle = res.data;
					that.titlebgcolor(res.data);
				},
			});

			// 题库年份
			uni.getStorage({
				key: "year_key",
				success: function(res) {
					console.log("年份", res.data);
					that.year = res.data;
				},
				fail() {
					that.$u.route({
						url: "pages/setting/setting",
						params: {},
					});
				},
			});
		},
		onUnload() {
			console.log("点击返回键：onUnload()");
			var that = this;
			innerAudioContextbb.stop();
			this.videoContext = uni.createVideoContext("myVideo");
			this.videoContext.pause();
		},
		onShow() {
			this.openDb();
		},
		methods: {

			handlevideoBox() {
				this.videoboxviible = true
				this.videoimgvisible = false
			},
			handleClosevideo() {
				this.videoboxviible = false
				this.videoimgvisible = true
			},

			handleCloseimg() {
				this.imgmodalBox = false
			},
			handleImgBig(img) {

				console.log("放大", img);
				this.imgmodalBox = true
				this.tiimg = img

				// console.log("放大", img)
				// var arrimg = [];
				// arrimg.push(img)
				// wx.previewImage({
				// 	urls: arrimg, //需要预览的图片http链接列表，多张的时候，url直接写在后面就行了
				// 	current: '', // 当前显示图片的http链接，默认是第一个
				// 	success: function(res) {
				// 		console.log("已放大")
				// 	},
				// 	fail: function(res) {},
				// 	complete: function(res) {},
				// })

			},

			handleVideo(e) {
				console.log("videoerro", e)
				this.videoVisible = false
			},

			// 触摸滑动开始
			touchstart(e) {
				this.startX = e.changedTouches[0].clientX; // 触摸起点
			},
			// 触摸滑动结束
			touchend(e) {
				this.endX = e.changedTouches[0].clientX; // 触摸终点
				const subX = this.endX - this.startX; // 触摸滑动距离
				console.log("subX", subX);

				if (subX > 100) {
					// 手指大幅度从左向右滑动---上一题
					// 非第一题有动画
					if (this.viewsindex !== 0) {
						// 动画：右出左进
						// 先横向向右移至100%，即整块移没
						// 再使题目部分透明
						// 然后趁透明横向向左移至-100%
						// 接着横向向右移动至初始位置并恢复透明度
						this.animation
							.translateX("100%")
							.step()
							.opacity(0)
							.step({
								duration: 10,
							})
							.translateX("-100%")
							.step({
								duration: 10,
							})
							.translateX(0)
							.opacity(1)
							.step();
						// 动态动画
						this.animationData = this.animation.export();

						// 为避免uniapp动画只有第一次生效，必须延迟删除动画实例数据
						setTimeout(() => {
							this.animationData = {};
						}, 250);
					}
					if (this.viewsindex <= 0) {
						this.viewsindex = 0;
					} else {
						this.viewsindex -= 1;
						// 上一题
						this.minidbid(this.viewsindex);
					}
				} else if (subX < -100) {
					// 手指大幅度从右向左滑动---下一题
					// 非最后一题有动画
					if (this.viewsindex + 1 == this.datacount) return;
					if (this.viewsindex !== this.datacount) {
						// 动画：左出右进
						this.animation
							.translateX("-100%")
							.step()
							.opacity(0)
							.step({
								duration: 10,
							})
							.translateX("100%")
							.step({
								duration: 10,
							})
							.translateX(0)
							.opacity(1)
							.step();

						this.animationData = this.animation.export();

						setTimeout(() => {
							this.animationData = {};
						}, 250);
					}

					this.viewsindex += 1;
					// 下一题
					this.minidbid(this.viewsindex);
				}
			},


			//读题
			btnBackMusicType(type, value) {
				console.log("语音")
				var that = this;
				let playurl = ""
				if (value == null) {
					return false;
				}
				if (type == 'yuyin') {
					playurl = "https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/yuyin/" + value + ".mp3";
				}

				if (that.lang == 'cn') {

					if (type == 'jieshi') {
						playurl = "https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/jieshi/" + value +
							"_js.mp3"
					}
					if (type == 'jq') {
						playurl = "https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/jiqiao/" + value +
							"_jq.mp3"
					}
				} else {

					if (type == 'jq') {
						playurl = "https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/jieshi/" + value +
							"_js.mp3"
					}
					// if (type == 'jieshi') {
					// 	playurl = "https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/jieshi/" + value +
					// 		"_js.mp3"
					// }

				}

				// var playurl = "https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/yuyin/" + value + ".mp3";
				innerAudioContextbb.autoplay = true;
				innerAudioContextbb.loop = false; //循环播放
				innerAudioContextbb.src = playurl + "?id=" + Math.ceil(Math.random() * 10);
				console.log("that.musicShow", that.musicShow);
				console.log("innerAudioContext.src", innerAudioContextbb.src);
				// console.log("innerAudioContext",innerAudioContext);
				// if()
				if (that.musicShow) {
					console.log("播放");
					innerAudioContextbb.onPlay(() => {
						// 播放监听
						console.log("播放!");
						that.musicShow = false;
					});
				} else {
					console.log("暂停");
					innerAudioContextbb.onPause(() => {
						// 暂停监听
						console.log("暂停播放!");
						that.musicShow = true;
					});
				}

				innerAudioContextbb.onEnded(() => {
					// 结束播放监听
					console.log("播放结束!");
					that.musicShow = true;
					//自动切换事件
					//this.qeihuanwenjian()
				});

				// this.musicShow=!this.musicShow;
			},
			feed() {
				var that = this;
				//链接到意见反馈页面
				var feedtype = 1;
				var ind = that.viewsindex;
				var dbid = that.subarrid[ind].tid;
				uni.navigateTo({
					url: "../feedback/feedback?fankuitype=" + feedtype + "&tid=" + dbid,
				});
			},
			//小程序错题收藏
			hatekemu(kemu) {
				var that = this;
				that.https({
					url: cuotilist_api,
					method: "POST",
					header: {
						"content-type": "application/json",
					},
					data: {
						lang: that.lolang,
						tlang: that.lolang,
						ktype: that.subject,
						zhengjianlx: that.zzlx, //资格证是 科目是0
						kemu: that.kemu,
						ttype: -1,
					},
					success: (res) => {
						console.log(res);
						that.hatelist = res.list;
					},
					fail: (err) => {
						console.log(err);
						uni.showModal({
							title: "错误提示",
							content: err,
							success: function(res) {
								if (res.confirm) {
									console.log("用户点击确定");
								} else if (res.cancel) {
									console.log("用户点击取消");
								}
							},
						});
					},
				});
			},
			//答题卡
			datika() {
				var that = this;
				that.showcart = true;
			},
			//单选题
			chack(jawap) {
				var that = this;
				console.log("jawap:", jawap);
				if (that.worngly) {
					console.log("已经选择过了  不能再选择");
				} else {
					var ind = that.viewsindex;
					// 注释2
					// // #ifdef APP-PLUS
					// var dbid = that.subarrid[ind].tid;
					// console.log(dbid);
					// console.log("dbid", dbid);
					// // updateSQL(
					// // 	"data",
					// // 	"Tiku", {
					// // 		useranswer: jawap,
					// // 	},
					// // 	"tid",
					// // 	dbid
					// // ).then((res) => {
					// console.log("用户答案已保存");
					// if (that.subarr.answer == jawap) {
					// 	//答案正确 ,
					// 	if (jawap == "A") {
					// 		that.jawap[0] = "anschack";
					// 	} else if (jawap == "B") {
					// 		that.jawap[1] = "anschack";
					// 	} else if (jawap == "C") {
					// 		that.jawap[2] = "anschack";
					// 	} else {
					// 		that.jawap[3] = "anschack";
					// 	}
					// 	that.sska(1);
					// 	if (that.nextchecked) {
					// 		//setTimeout(function(){
					// 		that.nextt();
					// 		//},500)
					// 	}
					// } else {
					// 	//打错了！
					// 	if (jawap == "A") {
					// 		that.jawap[0] = "wrong";
					// 	} else if (jawap == "B") {
					// 		that.jawap[1] = "wrong";
					// 	} else if (jawap == "C") {
					// 		that.jawap[2] = "wrong";
					// 	} else {
					// 		that.jawap[3] = "wrong";
					// 	}
					// 	//that.cuoti();
					// 	that.sska(0);
					// 	//正确答案是
					// 	if (that.subarr.answer == "A") {
					// 		that.jawap[0] = "anschack 1";
					// 	} else if (that.subarr.answer == "B") {
					// 		that.jawap[1] = "anschack 1";
					// 	} else if (that.subarr.answer == "C") {
					// 		that.jawap[2] = "anschack 1";
					// 	} else {
					// 		that.jawap[3] = "anschack 1";
					// 	}
					// 	// if (that.nextchecked) {
					// 	// 	setTimeout(function() {
					// 	// 		that.nextt();
					// 	// 	}, 5000);
					// 	// }
					// 	//that.jawap = 'wrong';
					// 	//进行收藏
					// }
					// // });
					// // #endif




					console.log("ind", ind);
					//console.log('that.subarrid', that.subarrid);
					that.subarrid[ind].useranswer = jawap;
					that.subarrid[ind].answer = that.subarr.answer;
					that.subarrid[ind].tid = that.subarr.tid;

					console.log("testind", ind, that.subarrid[ind]);
					if (that.subarr.answer == jawap) {
						//答案正确 ,
						if (jawap == "A") {
							that.jawap[0] = "anschack";
						} else if (jawap == "B") {
							that.jawap[1] = "anschack";
						} else if (jawap == "C") {
							that.jawap[2] = "anschack";
						} else {
							that.jawap[3] = "anschack";
						}
						that.sska(1);
						if (that.nextchecked) {
							//setTimeout(function(){
							that.nextt();
							//},500)
						}
					} else {
						//打错了！
						if (jawap == "A") {
							that.jawap[0] = "wrong";
						} else if (jawap == "B") {
							that.jawap[1] = "wrong";
						} else if (jawap == "C") {
							that.jawap[2] = "wrong";
						} else {
							that.jawap[3] = "wrong";
						}
						//that.cuoti();
						that.sska(0);
						//正确答案是
						if (that.subarr.answer == "A") {
							that.jawap[0] = "anschack 1";
						} else if (that.subarr.answer == "B") {
							that.jawap[1] = "anschack 1";
						} else if (that.subarr.answer == "C") {
							that.jawap[2] = "anschack 1";
						} else {
							that.jawap[3] = "anschack 1";
						}
					}
					//存储答案
					//console.log("star id=",id);
				}

				//查看是否打开自动开关，进入到下一题

				//显示正确答案
				that.dbjawap = that.subarr.answer;
				that.worngly = true;
			},
			//判断题
			chackjudge(jawap) {
				var that = this;
				console.log("jawap:", jawap);
				if (that.worngly) {
					console.log("已经选择过了  不能再选择");
				} else {
					var ind = that.viewsindex;
					var dbid = that.subarrid[ind].tid;
					console.log(dbid);
					console.log("dbid", dbid);
					that.subarrid[ind].useranswer = jawap;
					that.subarrid[ind].answer = that.subarr.answer;
					that.subarrid[ind].tid = that.subarr.tid;



					// 注释3
					// // #ifdef APP-PLUS
					// // updateSQL(
					// // 	"data",
					// // 	"Tiku", {
					// // 		useranswer: jawap,
					// // 	},
					// // 	"tid",
					// // 	dbid
					// // ).then((res) => {
					// console.log("用户答案已保存");
					// console.log("that.subarr.answer", that.subarr.answer, jawap);
					// if (that.subarr.answer == "对") {
					// 	console.log("~~~~~~~~~~~~~~~~~~~~~");
					// }
					// if (that.subarr.answer == jawap) {
					// 	console.log("答对了 自动跳转下一个题111111");
					// 	//答案正确 ,
					// 	if (jawap == "对") {
					// 		that.jawapjudge[0] = "anschack";
					// 	} else {
					// 		that.jawapjudge[1] = "anschack";
					// 	}

					// 	console.log("that.nextchecked", that.nextchecked);
					// 	that.sska(1);

					// 	if (that.nextchecked == true) {
					// 		console.log("答对了 自动跳转下一个题22222222222222222222222222223333333333333333");
					// 		that.nextt();
					// 	}
					// } else {
					// 	//打错了！
					// 	if (jawap == "对") {
					// 		that.jawapjudge[0] = "wrong";
					// 	} else {
					// 		that.jawapjudge[1] = "wrong";
					// 	}
					// 	//正确答案是
					// 	if (that.subarr.answer == "对") {
					// 		that.jawapjudge[0] = "anschack 1";
					// 	} else {
					// 		that.jawapjudge[1] = "anschack 1";
					// 	}

					// 	that.sska(0);
					// 	//that.cuoti();
					// 	//that.jawap = 'wrong';
					// 	//进行收藏
					// }
					// // });
					// // #endif





					if (that.subarr.answer == jawap) {
						//答案正确 ,
						if (jawap == "对") {
							that.jawapjudge[0] = "anschack";
						} else {
							that.jawapjudge[1] = "anschack";
						}
						that.sska(1);
						if (that.nextchecked) {
							//setTimeout(function(){
							that.nextt();
							//},500)
						}
					} else {
						//打错了！
						if (jawap == "对") {
							that.jawapjudge[0] = "wrong";
						} else {
							that.jawapjudge[1] = "wrong";
						}
						//正确答案是
						if (that.subarr.answer == "对") {
							that.jawapjudge[0] = "anschack 1";
						} else {
							that.jawapjudge[1] = "anschack 1";
						}
						that.sska(0);
						//that.cuoti();
					}
					//存储答案
					//console.log("star id=",id);
					//显示正确答案
					that.dbjawap = that.subarr.answer;
					that.worngly = true;
				}

				//查看是否打开自动开关，进入到下一题
			},
			//多选题
			chackduo(jawaptar) {
				var that = this;
				var j = that.answers;
				var text = jawaptar;
				var ind = j.indexOf(text);
				if (ind === -1) {
					that.answers.push(text);
				} else {
					that.answers.splice(ind, 1);
				}
				// that.answers = j;
				console.log("jawaptar", that.answers);
			},
			duoque() {
				var that = this;
				if (that.answers.length < 2) {
					return false;
				}
				console.log(that.subarr);
				var dbid = that.subarr.tid;

				var jawaptar = that.answers.sort();
				console.log(dbid);
				console.log("dbid", dbid);
				var dbjawaptar = jawaptar.toString();

				var ind = that.viewsindex;
				that.subarrid[ind].useranswer = dbjawaptar;
				that.subarrid[ind].answer = that.subarr.answer;
				that.subarrid[ind].tid = that.subarr.tid;
				//var jawapstr = jawaptar
				// #ifdef APP-PLUS
				// updateSQL(
				// 	"data",
				// 	"Tiku", {
				// 		useranswer: dbjawaptar,
				// 	},
				// 	"tid",
				// 	dbid
				// ).then((res) => {
				// 	console.log("用户答案已保存");
				// });
				// #endif

				//页面上展示正确答案
				//判断错误答案
				let sane = 3;
				var twrajawap = that.subarr.answer;
				that.dbjawap = twrajawap;
				if (that.subarr.option4 == "") {
					sane = 2;
				}
				var jawapjson = twrajawap.split("");
				if (jawapjson.indexOf("A") !== -1) {
					that.jawap[0] = "anschack 1";
				}
				if (jawapjson.indexOf("B") !== -1) {
					that.jawap[1] = "anschack 1";
				}
				if (jawapjson.indexOf("C") !== -1) {
					that.jawap[2] = "anschack 1";
				}
				if (sane == 3) {
					if (jawapjson.indexOf("D") !== -1) {
						that.jawap[3] = "anschack 1";
					}
				}
				console.log("json = ", jawapjson);

				let arrload = getArrloads(jawapjson, jawaptar);
				console.log("=======", arrload);
				let ashane = getArrEqual(jawapjson, jawaptar);
				if (arrload.length == 0 && jawapjson.length == jawaptar.length) {
					console.log("全部正确");
					that.sska(1);
					if (that.nextchecked) {
						//setTimeout(function(){
						that.nextt();
						//},50)
					}
				} else {
					console.log("部分正确");
					that.sska(0);
					// for (var i = 0; i < sane; i++) {

					// 	if (jawapjson[i] == jawaptar[i]) {
					// 		that.jawap[i] = 'anschack 1';
					// 	} else {
					// 		that.jawap[i] = 'wrong';
					// 	}
					// }
					for (var t = 0; t < jawaptar.length; t++) {
						if (jawapjson.indexOf(jawaptar[t]) == -1) {
							if (jawaptar[t] == "A") {
								that.jawap[0] = "wrong";
							}
							if (jawaptar[t] == "B") {
								that.jawap[1] = "wrong";
							}
							if (jawaptar[t] == "C") {
								that.jawap[2] = "wrong";
							}
							if (jawaptar[t] == "D") {
								that.jawap[3] = "wrong";
							}
						}
					}
					//that.cuoti();
				}

				//选择正确的
				if (ashane.indexOf("A") !== -1) {
					that.jawap[0] = "anschack";
				}
				if (ashane.indexOf("B") !== -1) {
					that.jawap[1] = "anschack";
				}
				if (ashane.indexOf("C") !== -1) {
					that.jawap[2] = "anschack";
				}
				if (sane == 3) {
					if (ashane.indexOf("D") !== -1) {
						that.jawap[3] = "anschack";
					}
				}
				//没有选择的
				if (arrload.indexOf("A") !== -1) {
					that.jawap[0] = "wrong";
				}
				if (arrload.indexOf("B") !== -1) {
					that.jawap[1] = "wrong";
				}
				if (arrload.indexOf("C") !== -1) {
					that.jawap[2] = "wrong";
				}
				if (sane == 3) {
					if (arrload.indexOf("D") !== -1) {
						that.jawap[3] = "wrong";
					}
				}
				that.answers = []
			},
			sska(num) {
				var that = this;
				console.log("nummm", num);
				uni.setStorageSync(that.subject + "_winnow_" + that.lang + "_" + that.kemu, that.viewsindex);
				// uni.setStorage({
				// 	key: that.subject + '_pracice_' + that.kemu,
				// 	data: that.viewsindex,
				// 	success: function() {
				// 		console.log('success');
				// 	}
				// });
				that.subarrid[that.viewsindex].twrahate = num;
				//arrid
				var arrid = that.subarrid;

				//设置历史题
				// #ifdef MP-WEIXIN
				uni.setStorageSync("_winnow_" + that.subject + "_dati_" + that.lang + "_" + that.kemu, arrid);
				// uni.setStorage({
				// 	key: that.subject + '_dati_' + that.kemu,
				// 	data: arrid,
				// 	success: function() {
				// 		console.log('success');
				// 	}
				// });
				// #endif
				if (num == 1) {
					console.log("数据中添加一个正确");
					//数据中添加一个正确总数
					that.twracount = that.twracount + 1;
					//答题卡中表示正确
					console.log("that.subarrid[that.viewsindex]", that.subarrid[that.viewsindex]);

					that.subarrid[that.viewsindex].twrahate = 1;
					//播放音效   正确  先判断是否允许播放
					const innerAudioContextcuress = uni.createInnerAudioContext();
					//innerAudioContextcuress.stop();
					console.log("that.musicchecked", that.musicchecked);
					if (that.musicchecked) {
						console.log("播放声音 正确");

						//inAudioContext.autoplay = true;
						innerAudioContextcuress.src = "/static/media/cuss.mp3";
						innerAudioContextcuress.autoplay = true;
						innerAudioContextcuress.play();
						innerAudioContextcuress.onPlay(() => {
							console.log("开始播放");
						});

						innerAudioContextcuress.onError((res) => {
							console.log("开始播放错误！！！！！！！！！！！！！！！！！！！！！！");
							console.log(res.errMsg);
							console.log(res.errCode);
						});
						innerAudioContextcuress.onEnded(() => {
							console.log("正确声音播放完成");
							innerAudioContextcuress.destroy();
						});
					}
				} else {
					//数据中添加一个错误总数
					that.hatecount = that.hatecount + 1;
					//答题卡中表示错误
					that.subarrid[that.viewsindex].twrahate = 0;
					//播放音效  错误  先判断是否允许播放
					const innerAudioContext = uni.createInnerAudioContext();
					//innerAudioContext.stop();
					if (that.musicchecked) {
						innerAudioContext.autoplay = true;
						innerAudioContext.src = "/static/media/err.mp3";
						innerAudioContext.play();
						innerAudioContext.onPlay((s) => {
							console.log(s);
							console.log("开始播放");
						});
						innerAudioContext.onError((res) => {
							console.log(res.errMsg);
							console.log(res.errCode);
						});
						innerAudioContext.onEnded(() => {
							console.log("正确声音播放完成");
							innerAudioContext.destroy();
						});
					}
					//记录错题	//明天制作  complete
					that.cuoti();
				}
			},

			cuoti() {
				//记录错题
				var that = this;

				// 注释4
				// // #ifdef APP-PLUS
				// var dbid = that.subarrid[that.viewsindex].tid;
				// console.log("dbid", dbid);
				// updateSQL(
				// 	"data",
				// 	"Tiku", {
				// 		complete: 1,
				// 		collect: 1,
				// 	},
				// 	"tid",
				// 	dbid
				// ).then((res) => {
				// 	console.log("1111, wancheng");
				// 	//that.collects();
				// 	that.star = 1;
				// });
				// // #endif



				that.https({
					url: shoucang_api,
					method: "POST",
					header: {
						"content-type": "application/json",
					},
					data: {
						tid: that.subarr.tid,
						type: 1, //0 表示取消收藏， 1加入收藏 -1收藏数减1
						daan: that.subarrid[that.viewsindex].useranswer,
						tlang: that.lolang,
						ktype: that.subject,
						zhengjianlx: that.zzlx, //资格证是 科目是0
						kemu: that.kemu,
						ttype: -1,
					},
					success: (res) => {
						console.log(res);
						that.star = 1;
						//that.hatekemu();
					},
					fail: (err) => {
						console.log(err);
						uni.showModal({
							title: "错误提示",
							content: err,
							success: function(res) {
								if (res.confirm) {
									console.log("用户点击确定");
								} else if (res.cancel) {
									console.log("用户点击取消");
								}
							},
						});
					},
				});
			},
			collects() {
				var that = this;

				var dbid = that.subarrid[that.viewsindex].tid;

				console.log("dbid", dbid);


				// 注释5
				// // #ifdef APP-PLUS
				// if (that.star == 0) {
				// 	updateSQL(
				// 		"data",
				// 		"Tiku", {
				// 			collect: 1,
				// 		},
				// 		"tid",
				// 		dbid
				// 	).then((res) => {
				// 		console.log("1111, wancheng");
				// 		that.star = 1;
				// 	});
				// } else {
				// 	updateSQL(
				// 		"data",
				// 		"Tiku", {
				// 			collect: 0,
				// 		},
				// 		"tid",
				// 		dbid
				// 	).then((res) => {
				// 		console.log("1111, wancheng");
				// 		that.star = 0;
				// 	});
				// }
				// // #endif

				if (that.star == 0) {
					that.https({
						url: shoucang_api,
						method: "POST",
						header: {
							"content-type": "application/json",
						},
						data: {
							tid: that.subarr.tid,
							type: 1, //0 表示取消收藏， 1加入收藏 -1收藏数减1
							daan: that.subarrid[that.viewsindex].useranswer,
							tlang: that.lolang,
							ktype: that.subject,
							zhengjianlx: that.zzlx, //资格证是 科目是0
							kemu: that.kemu,
							ttype: -1,
						},
						success: (res) => {
							console.log(res);
							that.star = 1;
							//that.hatekemu();
						},
						fail: (err) => {
							console.log(err);
							uni.showModal({
								title: "错误提示",
								content: err,
								success: function(res) {
									if (res.confirm) {
										console.log("用户点击确定");
									} else if (res.cancel) {
										console.log("用户点击取消");
									}
								},
							});
						},
					});
				} else {
					that.https({
						url: shoucang_api,
						method: "POST",
						header: {
							"content-type": "application/json",
						},
						data: {
							tid: that.subarr.tid,
							type: 0, //0 表示取消收藏， 1加入收藏 -1收藏数减1
							daan: that.subarrid[that.viewsindex].useranswer,
							tlang: that.lolang,
							ktype: that.subject,
							zhengjianlx: that.zzlx, //资格证是 科目是0
							kemu: that.kemu,
							ttype: -1,
						},
						success: (res) => {
							console.log(res);
							that.star = 0;
							//that.hatekemu();
						},
						fail: (err) => {
							console.log(err);
							uni.showModal({
								title: "错误提示",
								content: err,
								success: function(res) {
									if (res.confirm) {
										console.log("用户点击确定");
									} else if (res.cancel) {
										console.log("用户点击取消");
									}
								},
							});
						},
					});
				}

			},

			tiao(ind) {
				var that = this;
				console.log("ind ", ind);
				that.viewsindex = ind;
				var dbid = that.subarrid[ind].tid;
				// 注释6
				// //#ifdef APP-PLUS
				// that.subjectarr(dbid);
				// //#endif


				that.minidbid(ind);
				//that.viewsindex = ind;
			},
			clearindex() {
				var that = this;
				uni.setStorage({
					key: that.subject + "_winnow_" + that.lang + "_" + that.kemu,
					data: 0,
					success: function() {
						// that.backindex();
					},
				});
				//数据库中清理记录

				// 注释7
				// // #ifdef APP-PLUS
				// uni.showModal({
				// 	title: this.$t("keeping.提示"),
				// 	content: this.$t("keeping.提示内容"),
				// 	success: function(res) {
				// 		if (res.confirm) {
				// 			updateSQL(
				// 				"data",
				// 				"Tiku", {
				// 					useranswer: null,
				// 				},
				// 				"ktype",
				// 				that.subject
				// 			).then((res) => {
				// 				console.log("清理完成, wancheng");
				// 				that.hatecount = 0;
				// 				that.twracount = 0;
				// 				that.dbid();
				// 				var arrid = that.subarrid;
				// 				for (var u = 0; u < arrid.length; u++) {
				// 					if (arrid[u].twrahate !== 2) {
				// 						that.subarrid[u].twrahate = 2;
				// 					}
				// 				}
				// 				//清理完成  跳转到第一题
				// 				that.tiao(0);
				// 			});
				// 			console.log("用户点击确定");
				// 		} else if (res.cancel) {
				// 			console.log("用户点击取消");
				// 		}
				// 	},
				// });
				// // #endif


				uni.showModal({
					title: this.$t("keeping.提示"),
					content: this.$t("keeping.提示内容"),
					success: function(res) {
						if (res.confirm) {
							that.https({
								url: alldelshoucang_api,
								method: "POST",
								header: {
									"content-type": "application/json",
								},
								data: {},
								success: (res) => {
									console.log(res);
									//app缓存到本地
									//小程序读取在线
									that.subarr.collect = 0;
									that.star = 0;

									that.hatekemu();
									uni.setStorage({
										key: "_winnow_" + that.subject + "_dati_" + that
											.lang + "_" +
											that.kemu,
										data: [],
										success: function() {
											console.log("success");

											that.hatecount = 0;
											that.twracount = 0;
											var dbcount = that.datacount;
											var est = [];
											for (var i = 0; i < dbcount; i++) {
												est[i] = {
													useranswer: null,
													answer: null,
													tid: 0,
													twrahate: 2,
												};
											}
											that.subarrid = est;

											that.minidbid(0);
										},
									});
								},
								fail: (err) => {
									console.log(err);
									uni.showModal({
										title: "错误提示",
										content: err,
										success: function(res) {
											if (res.confirm) {
												console.log("用户点击确定");
											} else if (res.cancel) {
												console.log("用户点击取消");
											}
										},
									});
								},
							});
						} else if (res.cancel) {
							console.log("用户点击取消");
						}
					},
				});
			},
			backindex() {
				var that = this;
				console.log("进入跳转");
				if (that.kemu == 0) {
					uni.switchTab({
						url: "../index/qualification",
					});
				} else {
					uni.switchTab({
						url: "../index/index",
					});
				}
			},
			//打开数据库
			openDb() {
				var that = this;
				if (isOpen("data")) return;
				openDb("data").then((res) => {
					console.log(res);

					that.dbcount(that.kemu);
				});
			},
			minidbcount(dbcount) {
				var that = this;
				// uni.showLoading({
				// 	title: "加载中...",
				// 	mask: true,
				// });
				var est = [];
				console.log("minicount=", dbcount);
				for (var i = 0; i < dbcount; i++) {
					est[i] = {
						useranswer: null,
						answer: null,
						tid: 0,
						twrahate: 2,
					};
				}
				that.subarrid = est;
				//记录查询
				uni.getStorage({
					key: that.subject + "_winnow_" + that.lang + "_" + that.kemu,
					success: function(res) {
						console.log(res, "==*********8==");
						console.log(res.data);
						var indexdata = Number(res.data);
						that.viewsindex = indexdata;
						setTimeout(function() {
							that.minidbid(indexdata);
						}, 100);
					},
					fail(e) {
						console.log("index key no", e);
						//没有任何记录

						uni.setStorage({
							key: that.subject + "_winnow_" + that.lang + "_" + that.kemu,
							data: 0,
							success: function() {
								console.log("success");
								setTimeout(function() {
									that.minidbid();
								}, 100);
							},
						});
					},
				});

				//小程序subarrid值赋值

				uni.getStorage({
					key: "_winnow_" + that.subject + "_dati_" + that.lang + "_" + that.kemu,
					success: function(res) {
						console.log(res);
						var twra = 0;
						var hate = 0;
						if (res.data.length == dbcount) {
							that.subarrid = res.data;
							var tipanduan = res.data;

							//计算 错题对题数量

							tipanduan.forEach((item, key) => {
								if (item.useranswer !== undefined || item.useranswer !== null) {
									if (item.twrahate == 1) {
										twra++;
									}
									if (item.twrahate == 0) {
										hate++;
									}
								}
							});

							// console.log("eeeerrrrroooorrrr",tipanduan)
							// if(tipanduan){

							// }else{
							// 	for (var i = 0; i < tipanduan.length; i++) {
							// 		if (tipanduan[i].useranswer !== undefined && tipanduan[i].useranswer !== null) {
							// 			if (tipanduan[i].twrahate == 1) {
							// 				twra++;
							// 			}
							// 			if (tipanduan[i].twrahate == 0) {
							// 				hate++;
							// 			}
							// 		}
							// 	}
							// }

							that.hatecount = hate;
							that.twracount = twra;
						} else {
							//网上的数量和本地数量不符，更新错题列表

							that.hatecount = hate;
							that.twracount = twra;
							uni.setStorage({
								key: "_winnow_" + that.subject + "_dati_" + that.lang + "_" + that
									.kemu,
								data: est,
								success: function() {
									console.log("success");
								},
							});
						}
					},
					fail(e) {
						console.log("index key no", e);
						that.hatecount = 0;
						that.twracount = 0;
						//没有任何记录
						var est = [];
						console.log("minicount=", dbcount);
						for (var i = 0; i < dbcount; i++) {
							est[i] = {
								useranswer: null,
								answer: null,
								tid: 0,
								twrahate: 2,
							};
						}
						that.subarrid = est;
						//获取数量
						console.log("mini est = ", est);
						uni.setStorage({
							key: "_winnow_" + that.subject + "_dati_" + that.lang + "_" + that.kemu,
							data: est,
							success: function() {
								console.log("success");
							},
						});
					},
				});
				uni.hideLoading();

				//查询已完成的
			},
			minidbid(indexdata) {

				// this.videoVisible = false
				// if (this.lolang == "CN") {
				// 	this.year = "2023";
				// }
				var that = this;
				// uni.showLoading({
				// 	title: "加载中",
				// 	mask: true,
				// });
				//获取引起
				var index = 0;
				console.log("indexdata获取数据", indexdata);
				if (indexdata !== undefined) {
					index = indexdata;
				} else {
					index = that.viewsindex;
				}

				that.https({
					url: jingxuan_api,
					method: "POST",
					header: {
						"content-type": "application/json",
					},
					data: {
						lang: that.lolang,
						zzlx: that.zzlx,
						kemu: that.kemu, //资格证是 科目是0
						ktype: that.subject,
						index: index,
						year: that.lolang == "CN" ? '2023' : that.year,
						jingxuan: '1',
					},
					success: (res) => {
						that.videoboxviible = false
						if (res.timu.haveVideo == 1) {
							that.videoVisible = true
							that.videoimgvisible = true
						} else {
							that.videoVisible = false
							that.videoimgvisible = false
						}
						// uni.hideLoading();
						console.log("/////////////////////题目数量", res);
						that.datacount = res.count
						var timu = res.timu;
						var ja_tiku = that.subarrid[index];

						this.timuList = res.timu;

						//查看有没有收藏的？
						var shoucanglist = that.hatelist;

						var shoucangindex = shoucanglist.indexOf(shoucanglist.filter((d) => d.tid == timu.tid)[
							0]);
						//查找错题收藏中， 如果有直接写

						//判断是否选择过了
						let arrjson = that.subarrid[index];

						if (shoucangindex == -1) {
							//错题收藏没有
							var timudata = {
								typename: null,
								collect: 0,
								complete: 0,
								examcomplete: 0,
							};
						} else {
							//错题收藏中存在
							var timudata = {
								typename: null,
								collect: 1,
								complete: 1,
								examcomplete: 1,
							};
							//console.log("shoucanglist",shoucanglist)
							//arrjson.useranswer = shoucanglist[shoucangindex].daan;
							arrjson.tid = timu.tid;
							arrjson.answer = timu.answer;
							arrjson.twrahate = 1;
						}

						var est = Object.assign(timu, timudata);
						// timulist.push(timu);
						// timulist.push(timudata);
						// console.log(obj);

						var tipanduan = that.subarrid;
						var twra = 0;
						var hate = 0;
						//计算 错题对题数量
						for (var i = 0; i < tipanduan.length; i++) {
							if (tipanduan[i].useranswer !== undefined && tipanduan[i].useranswer !== null) {
								if (tipanduan[i].twrahate == 1) {
									twra++;
								}
								if (tipanduan[i].twrahate == 0) {
									hate++;
								}
							}
						}
						that.hatecount = hate;
						that.twracount = twra;

						let arrjsons = est;
						// 该题是否收藏
						if (arrjsons.collect == 1) {
							that.star = 1;
						} else {
							that.star = 0;
						}

						// 设置图片
						if (arrjsons.timg == "") {
							that.imgmodalBox = false
						}
						that.tiimg = yunurl + arrjsons.timg;
						that.dbjawap = "";
						setTimeout(function() {
							that.flag = 0; //防止再次滑动
						}, 50);

						console.log("arrjson err=" + JSON.stringify(arrjson));
						if (arrjson !== undefined) {
							if (arrjson.useranswer !== undefined && arrjson.useranswer !== null) {
								//已经选择过了
								if (arrjsons.ttype == 1) {
									that.jawap[0] = "";
									that.jawap[1] = "";
									that.jawap[2] = "";
									that.jawap[3] = "";
									that.worngly = true;
									that.dbjawap = "";
									var jawap = arrjson.useranswer;
									if (arrjsons.answer == jawap) {
										//答案正确 ,
										if (jawap == "A") {
											that.jawap[0] = "anschack";
										} else if (jawap == "B") {
											that.jawap[1] = "anschack";
										} else if (jawap == "C") {
											that.jawap[2] = "anschack";
										} else {
											that.jawap[3] = "anschack";
										}
									} else {
										//打错了！
										if (jawap == "A") {
											that.jawap[0] = "wrong";
										} else if (jawap == "B") {
											that.jawap[1] = "wrong";
										} else if (jawap == "C") {
											that.jawap[2] = "wrong";
										} else {
											that.jawap[3] = "wrong";
										}
										//正确答案是
										if (arrjson.answer == "A") {
											that.jawap[0] = "anschack 1";
										} else if (arrjson.answer == "B") {
											that.jawap[1] = "anschack 1";
										} else if (arrjson.answer == "C") {
											that.jawap[2] = "anschack 1";
										} else {
											that.jawap[3] = "anschack 1";
										}

										//that.jawap = 'wrong';
										//进行收藏
									}
									that.dbjawap = arrjsons.answer;
								}
								if (arrjsons.ttype == 0) {
									that.jawapjudge[0] = "";
									that.jawapjudge[1] = "";
									that.worngly = true;
									that.dbjawap = "";
									var jawap = arrjson.useranswer;
									if (arrjsons.answer == jawap) {
										//答案正确 ,
										if (jawap == "对") {
											that.jawapjudge[0] = "anschack";
										} else {
											that.jawapjudge[1] = "anschack";
										}
									} else {
										//打错了！
										if (jawap == "对") {
											that.jawapjudge[0] = "wrong";
										} else {
											that.jawapjudge[1] = "wrong";
										}
										//正确答案是
										if (arrjson.answer == "对") {
											that.jawapjudge[0] = "anschack 1";
										} else {
											that.jawapjudge[1] = "anschack 1";
										}
									}
									that.dbjawap = arrjsons.answer;
								}
								if (arrjsons.ttype == 2) {
									console.log("duo xuan ti jinru pand");
									that.jawap[0] = "";
									that.jawap[1] = "";
									that.jawap[2] = "";
									that.jawap[3] = "";
									that.answers = [];
									that.worngly = true;
									that.dbjawap = "";
									var jawap = arrjson.useranswer;
									var jawapjson = jawap.split(",");
									var jawaparrdb = arrjsons.answer;

									//答案正确 ,
									let sane = 3;
									if (arrjsons.option4 == "") {
										sane = 2;
									}

									if (jawaparrdb.indexOf("A") !== -1) {
										that.jawap[0] = "anschack 1";
									}
									if (jawaparrdb.indexOf("B") !== -1) {
										that.jawap[1] = "anschack 1";
									}
									if (jawaparrdb.indexOf("C") !== -1) {
										that.jawap[2] = "anschack 1";
									}
									if (sane == 3) {
										if (jawaparrdb.indexOf("D") !== -1) {
											that.jawap[3] = "anschack 1";
										}
									}
									let ashane = getArrEqual(jawaparrdb, jawapjson);
									console.log("(((((())))))", ashane);
									let arrload = getArrload(jawaparrdb, jawapjson);
									console.log("=======", arrload);
									console.log(jawaparrdb, jawapjson);
									if (arrload.length == 0) {
										console.log("全部正确");
									} else {
										console.log("部分正确");

										// for (var i = 0; i < sane; i++) {
										// 	if (jawapjson[i] == jawaparrdb[i]) {
										// 		that.jawap[i] = 'anschack 1';
										// 	} else {
										// 		that.jawap[i] = 'wrong';
										// 	}
										// }
										for (var t = 0; t < jawapjson.length; t++) {
											if (jawaparrdb.indexOf(jawapjson[t]) == -1) {
												if (jawapjson[t] == "A") {
													that.jawap[0] = "wrong";
												}
												if (jawapjson[t] == "B") {
													that.jawap[1] = "wrong";
												}
												if (jawapjson[t] == "C") {
													that.jawap[2] = "wrong";
												}
												if (jawapjson[t] == "D") {
													that.jawap[3] = "wrong";
												}
											}
										}
									}

									//选择正确的
									if (ashane.indexOf("A") !== -1) {
										that.jawap[0] = "anschack";
									}
									if (ashane.indexOf("B") !== -1) {
										that.jawap[1] = "anschack";
									}
									if (ashane.indexOf("C") !== -1) {
										that.jawap[2] = "anschack";
									}
									if (sane == 3) {
										if (ashane.indexOf("D") !== -1) {
											that.jawap[3] = "anschack";
										}
									}
									//没有选择的
									if (arrload.indexOf("A") !== -1) {
										that.jawap[0] = "anschack 1";
									}
									if (arrload.indexOf("B") !== -1) {
										that.jawap[1] = "anschack 1";
									}
									if (arrload.indexOf("C") !== -1) {
										that.jawap[2] = "anschack 1";
									}
									if (sane == 3) {
										if (arrload.indexOf("D") !== -1) {
											that.jawap[3] = "anschack 1";
										}
									}

									console.log(that.jawap);

									that.dbjawap = arrjsons.answer;
								}
							} else {
								//还没选择过
								that.jawap[0] = "";
								that.jawap[1] = "";
								that.jawap[2] = "";
								that.jawap[3] = "";
								that.answers = [];
								that.jawapjudge[0] = "";
								that.jawapjudge[1] = "";
								that.worngly = false;
								that.dbjawap = "";
							}
						}
						that.viewsindex = index;
						that.subarr = arrjsons;

						that.videoUrl =
							"https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/shipin/" + that
							.subarr
							.tid + "_sp.mp4"

						if (that.subarr.chapter != null) {
							var s = "";
							s = that.subarr.chapter.replace(/\<font/gi, "<span style='color:#FF0000'");
							s = s.replace(/font>/gi, "span>");
							that.subarr.chapter = s
						}

					},
					fail: (err) => {
						uni.hideLoading();
						console.log(err);
						uni.showModal({
							title: "错误提示",
							content: err,
							success: function(res) {
								if (res.confirm) {
									console.log("用户点击确定");
								} else if (res.cancel) {
									console.log("用户点击取消");
								}
							},
						});
					},
				});
			},
			dbcount() {
				var that = this;
				if (that.lolang == "CN") {
					that.year = "2023";
				}
				// uni.showLoading({
				// 	title: "加载中...",
				// 	mask: true,
				// });
				//记录查询
				uni.getStorage({
					key: that.subject + "_winnow_" + that.lang + "_" + that.kemu,
					success: function(res) {
						console.log(res, "==*********8==");
						console.log(res.data);
						var indexdata = Number(res.data);
						that.viewsindex = indexdata;
						that.dbid(indexdata);
					},
					fail(e) {
						console.log("index key no", e);
						//没有任何记录

						uni.setStorage({
							key: that.subject + "_winnow_" + that.lang + "_" + that.kemu,
							data: 0,
							success: function() {
								console.log("success");
								that.dbid();
							},
						});
					},
				});

				plus.sqlite.selectSql({
					name: "data",
					sql: "select count(*) as num   from Tiku where kemu=" + that.kemu + " and ktype='" + that
						.subject + "' and tlang = '" + that.lolang + "' and year = '" + that.year +
						"' and jingxuan = 1",
					success(e) {
						console.log(e);
						console.log("=============数量", e[0].num);
						console.log("select count(*) as num   from Tiku where kemu=" + that.kemu + " and ktype='" +
							that.subject + "' and tlang = '" + that.lolang + "' and year = '" + that.year +
							"' and jingxuan = 1");
						that.datacount = e[0].num;
					},
					fail(e) {
						console.log(e);
						console.log("select count(*) as num   from Tiku where kemu=" + that.kemu + " and ktype='" +
							that.subject + "' and tlang = '" + that.lolang + "' and year = '" + that.year +
							"' and jingxuan = 1");
					},
				});

				//查询已完成的
			},
			dbid(indexdata) {
				var that = this;
				if (that.lolang == "CN") {
					that.year = "2023";
				}
				plus.sqlite.selectSql({
					name: "data",
					sql: "select answer, tid, useranswer  from Tiku where kemu=" + that.kemu + " and ktype='" +
						that.subject + "' and tlang = '" + that.lolang + "' and year = '" + that.year +
						"'and jingxuan = '1' order by ttype asc",
					success(est) {
						//console.log(est);
						console.log("select answer, tid, useranswer from Tiku where kemu=" + that.kemu +
							" and ktype='" + that.subject + "' and tlang = '" + that.lolang +
							"' and year = '" + that.year + "'");
						console.log("sssssssssssssss", est.length);
						var index = 0;
						console.log("indexdata", indexdata);
						if (indexdata !== undefined) {
							index = indexdata;
						} else {
							index = that.viewsindex;
						}

						console.log(index, "index");
						var tid = est[index].tid;
						that.viewsindex = index;
						that.subjectarr(tid);

						var hate = 0;
						var twra = 0;
						//console.log(est);

						console.log("ttttttttiiiiiiiidddddd", est[0].tid);
						for (var i = 0; i < est.length; i++) {
							//console.log(i,est[i].tid);
							if (est[i].useranswer !== undefined && est[i].useranswer !== null) {
								var jawap = est[i].useranswer;
								var jawapjson = jawap.split(",");
								var jawaparrdb = est[i].answer;
								let arrload = getArrload(jawaparrdb, jawapjson);
								if (arrload.length == 0) {
									est[i].twrahate = 1;
									twra++;
								} else {
									hate++;
									est[i].twrahate = 0;
								}
							} else {
								est[i].twrahate = 2;
							}
						}
						//console.log(est);
						console.log(est.length, twra, hate);
						that.twracount = twra;
						that.hatecount = hate;
						//console.log("that.subarrid = e;",est);
						that.subarrid = est;

						//记录session值来记录
						// uni.setStorage({
						//     key: that.subject+'_pracice_'+that.kemu,
						//     data: indexdata,
						//     success: function () {

						//     }
						// });

						uni.hideLoading();
					},
					fail(err) {
						console.log(err);
						uni.hideLoading();
					},
				});
			},
			subjectarr(tid) {
				// this.videoVisible = false
				var that = this;
				if (that.lolang == "CN") {
					that.year = "2023";
				}
				// uni.showLoading({
				// 	title: "加载中...",
				// 	mask: true,
				// });
				var sql = "select * from Tiku where kemu=" + that.kemu + " and  ktype='" + that.subject +
					"' and year = '" + that.year + "' and tlang = '" + that.lolang + "' and tid = '" + tid +
					"'and jingxuan = '1' ";
				plus.sqlite.selectSql({
					name: "data",
					sql: sql,
					success(e) {
						console.log(e);
						console.log(e.length);
						if (e.length == 0) {
							console.log("全部已经看完了！");
						} else {
							//that.subarr = e;

							that.https({
								url: tikutid_api,
								method: "POST",
								header: {
									"content-type": "application/json",
								},
								data: {
									tid: tid,
									year: that.lolang == 'CN' ? 2023 : that.year,
								},
								success: (res) => {
									console.log("接口数据", res, tid)
									that.videoboxviible = false
									if (res.timu.haveVideo == 1) {
										that.videoVisible = true
										that.videoimgvisible = true
									} else {
										that.videoVisible = false
										that.videoimgvisible = false
									}

								},
								fail: (err) => {
									console.log("接口未获取数据")

								},


							})


							that.smalljson(e);

							// uni.setStorage({
							// 	key: that.subject + '_pracice_' + that.kemu,
							// 	data: that.viewsindex,
							// 	success: function() {
							// 		console.log('success');
							// 	}
							// });
						}
						//console.log(e.length)
					},
					fail(e) {
						console.log(e);
						uni.hideLoading();
					},
				});
			},
			smalljson(jso) {
				// console.log("解析timu++++++++++++++++++++++++++++")
				//简单方法封装
				var that = this;
				let strs = this.newtools.fun2();
				let jsonstr = this.newtools.fun1(strs);

				let arrjson = jso[0];
				// console.log("arrjson.chapter",arrjson.chapter)
				// let chapters = chapter;
				// arrjson.chapter = graceRichText.format(chapters);

				if (arrjson.chapter) {
					let chapter = arrjson.chapter;
					let chapters = this.AES.decrypt(chapter, jsonstr, '_tongyongjiakao_');
					arrjson.chapter = chapters;
					console.log("解析timu++++++++++++++++++++++++++++", chapters)

					let type = uni.getStorageSync("exam_type")
					if (this.lolang == 'CN' && type == 'jiashizheng') {
						var s = "";
						s = arrjson.chapter.replace(/\<font/gi, "<span style='color:#FF0000'");
						s = s.replace(/font>/gi, "span>");
						arrjson.chapter = s
					}
				}




				// let option1 = arrjson.option1;
				// let option1s = option1;
				// arrjson.option1 = option1s;
				if (arrjson.option1) {
					let option1 = arrjson.option1;
					let option1s = this.AES.decrypt(option1, jsonstr, '_tongyongjiakao_');
					arrjson.option1 = option1s;
				}


				// let option2 = arrjson.option2;
				// let option2s = option2;
				// arrjson.option2 = option2s;
				if (arrjson.option2) {
					let option2 = arrjson.option2;
					let option2s = this.AES.decrypt(option2, jsonstr, '_tongyongjiakao_');
					arrjson.option2 = option2s;
				}


				// let option3 = arrjson.option3;
				// let option3s = option3;
				// arrjson.option3 = option3s;
				if (arrjson.option3) {
					let option3 = arrjson.option3;
					let option3s = this.AES.decrypt(option3, jsonstr, '_tongyongjiakao_');
					arrjson.option3 = option3s;
				}


				// let option4 = arrjson.option4;
				// let option4s = option4;
				// arrjson.option4 = option4s;
				if (arrjson.option4) {
					let option4 = arrjson.option4;
					let option4s = this.AES.decrypt(option4, jsonstr, '_tongyongjiakao_');
					arrjson.option4 = option4s;
				}


				// let question = arrjson.question;
				// let questions = question;
				// arrjson.question = questions;
				let question = arrjson.question;
				let questions = this.AES.decrypt(question, jsonstr, '_tongyongjiakao_');
				arrjson.question = questions;

				// let tdesc = arrjson.tdesc;
				// let tdescs = tdesc;
				// arrjson.tdesc = tdescs;
				if (arrjson.tdesc) {
					let tdesc = arrjson.tdesc;
					let tdescs = this.AES.decrypt(tdesc, jsonstr, '_tongyongjiakao_');
					arrjson.tdesc = tdescs;
				}

				console.log("解析timu++++++++++++++++++++++++++++");

				if (arrjson.collect == 1) {
					that.star = 1;
				} else {
					that.star = 0;
				}

				//判断是否有图片
				// console.log(arrjson.timg.length);
				if (arrjson.timg != null && arrjson.timg.length > 0) {
					//var imgname = getimgname(arrjson.timg) + '.json';
					var imgname = arrjson.timg;
					console.log("imgname", imgname);
					var filePath = "_doc/tjson/" + imgname;
					//先判断 static文件夹中是否存在
					var wwwpath = "_www/static/tjson/" + imgname;
					var dovpath = "_doc/tjson/" + imgname;

					that.tiimg = wwwpath;
					console.log("app图片", that.tiimg);

					// plus.io.resolveLocalFileSystemURL(
					// 	wwwpath,
					// 	function(entry) {
					// 		//如果www中找到
					// 		plus.io.requestFileSystem(plus.io.PRIVATE_WWW, function(fs) {
					// 			// fs.root是根目录操作对象DirectoryEntry
					// 			fs.root.getFile(
					// 				'static/tjson/' + imgname,
					// 				{
					// 					create: true
					// 				},
					// 				function(fileEntry) {
					// 					let base;
					// 					fileEntry.file(function(file) {
					// 						var fileReader = new plus.io.FileReader();
					// 						console.log('getFile:' + JSON.stringify(file));
					// 						fileReader.readAsText(file, 'utf-8');

					// 						fileReader.onloadend = function(evt) {
					// 							console.log('11' + evt);
					// 							console.log('evt.target' + evt.target);

					// 							if (base == 'undefined') {
					// 								that.tiimg = '';
					// 							} else {
					// 								that.tiimg = base;
					// 							}
					// 						};
					// 						fileReader.onprogress = function(e) {
					// 							console.log('onprogress ---> ', e);
					// 						};

					// 						fileReader.onload = function(evt) {
					// 							console.log('on load sss');
					// 							var imgstr = evt.target.result;
					// 							base = imgstr;
					// 							that.tiimg = base;
					// 						};
					// 						console.log(file.size + '--' + file.name);
					// 						fileReader.start();
					// 					});
					// 				}
					// 			);
					// 		});
					// 	},
					// 	function(e) {
					// 		//如果www中没有找到
					// 		plus.io.requestFileSystem(plus.io.PRIVATE_DOC, function(fs) {
					// 			// fs.root是根目录操作对象DirectoryEntry
					// 			fs.root.getFile(
					// 				'tjson/' + imgname,
					// 				{
					// 					create: true
					// 				},
					// 				function(fileEntry) {
					// 					let base;
					// 					fileEntry.file(function(file) {
					// 						var fileReader = new plus.io.FileReader();
					// 						console.log('getFile:' + JSON.stringify(file));
					// 						fileReader.readAsText(file, 'utf-8');

					// 						fileReader.onloadend = function(evt) {
					// 							console.log('11' + evt);
					// 							console.log('evt.target' + evt.target);

					// 							if (base == 'undefined') {
					// 								that.tiimg = '';
					// 							} else {
					// 								that.tiimg = base;
					// 							}
					// 						};
					// 						fileReader.onprogress = function(e) {
					// 							console.log('onprogress ---> ', e);
					// 						};

					// 						fileReader.onload = function(evt) {
					// 							console.log('on load sss');
					// 							var imgstr = evt.target.result;
					// 							base = imgstr;
					// 							that.tiimg = imgstr;
					// 						};
					// 						console.log(file.size + '--' + file.name);
					// 						fileReader.start();
					// 					});
					// 				}
					// 			);
					// 		});
					// 	}
					// );
					//判断完成了
				} else {}
				that.imgmodalBox = false
				//判断是否选择过了
				setTimeout(function() {
					that.flag = 0; //防止再次滑动
				}, 50);
				//判断是否有图片

				// console.log(arrjson.timg.length);
				// if (arrjson.timg.length > 0) {
				// 	var imgname = getimgname(arrjson.timg) + '.json';
				// 	console.log('imgname', imgname);
				// 	var filePath = '_doc/tjson/' + imgname;
				// 	plus.io.requestFileSystem(plus.io.PRIVATE_DOC, function(fs) {
				// 		// fs.root是根目录操作对象DirectoryEntry
				// 		fs.root.getFile(
				// 			'tjson/' + imgname,
				// 			{
				// 				create: true
				// 			},
				// 			function(fileEntry) {
				// 				let base;
				// 				fileEntry.file(function(file) {
				// 					var fileReader = new plus.io.FileReader();
				// 					console.log('getFile:' + JSON.stringify(file));
				// 					fileReader.readAsText(file, 'utf-8');

				// 					fileReader.onloadend = function(evt) {
				// 						console.log('11' + evt);
				// 						console.log('evt.target' + evt.target);
				// 						if (base == 'undefined') {
				// 							that.tiimg = '../../static/logo.png';
				// 						} else {
				// 							//var macstr = base.replaceAll('\r\n', '');
				// 							//console.log(macstr);
				// 							//console.log(evt.target.result);
				// 							that.tiimg = base;
				// 						}

				// 						// arrjson.timg = base;
				// 					};
				// 					fileReader.onprogress = function(e) {
				// 						console.log('onprogress ---> ', e);
				// 					};

				// 					fileReader.onload = function(evt) {
				// 						console.log('on load sss');
				// 						var imgstr = evt.target.result;
				// 						//console.log(imgstr);
				// 						var imgbase = imgstr.split('######');
				// 						let s = that.AES.decrypt(imgbase[0], '1jhtconstrj2age3', '_tongyongjiakao_');
				// 						//解密值
				// 						console.log(s);

				// 						//var johnr = imgbase[1].replaceAll('\r\n', '');
				// 						base = s + imgbase[1];
				// 						//console.log(base)
				// 						//var imgend = johnr;
				// 						that.tiimg = base;
				// 						//console.log({'tt':imgend},base)
				// 					};
				// 					console.log(file.size + '--' + file.name);
				// 					//console.log(base);
				// 				});
				// 			}
				// 		);
				// 	});
				// }
				//判断是否选择过了
				if (arrjson.useranswer !== undefined && arrjson.useranswer !== null) {
					//已经选择过了
					if (arrjson.ttype == 1) {
						that.jawap[0] = "";
						that.jawap[1] = "";
						that.jawap[2] = "";
						that.jawap[3] = "";
						that.worngly = true;
						that.dbjawap = "";
						var jawap = arrjson.useranswer;
						if (arrjson.answer == jawap) {
							//答案正确 ,
							if (jawap == "A") {
								that.jawap[0] = "anschack";
							} else if (jawap == "B") {
								that.jawap[1] = "anschack";
							} else if (jawap == "C") {
								that.jawap[2] = "anschack";
							} else {
								that.jawap[3] = "anschack";
							}
						} else {
							//打错了！
							if (jawap == "A") {
								that.jawap[0] = "wrong";
							} else if (jawap == "B") {
								that.jawap[1] = "wrong";
							} else if (jawap == "C") {
								that.jawap[2] = "wrong";
							} else {
								that.jawap[3] = "wrong";
							}
							//正确答案是
							if (arrjson.answer == "A") {
								that.jawap[0] = "anschack 1";
							} else if (arrjson.answer == "B") {
								that.jawap[1] = "anschack 1";
							} else if (arrjson.answer == "C") {
								that.jawap[2] = "anschack 1";
							} else {
								that.jawap[3] = "anschack 1";
							}

							//that.jawap = 'wrong';
							//进行收藏
						}
						that.dbjawap = arrjson.answer;
					}
					if (arrjson.ttype == 0) {
						that.jawapjudge[0] = "";
						that.jawapjudge[1] = "";
						that.worngly = true;
						that.dbjawap = "";
						var jawap = arrjson.useranswer;
						if (arrjson.answer == jawap) {
							//答案正确 ,
							if (jawap == "对") {
								that.jawapjudge[0] = "anschack";
							} else {
								that.jawapjudge[1] = "anschack";
							}
						} else {
							//打错了！
							if (jawap == "对") {
								that.jawapjudge[0] = "wrong";
							} else {
								that.jawapjudge[1] = "wrong";
							}
							//正确答案是
							if (arrjson.answer == "对") {
								that.jawapjudge[0] = "anschack 1";
							} else {
								that.jawapjudge[1] = "anschack 1";
							}
						}
						that.dbjawap = arrjson.answer;
					}
					if (arrjson.ttype == 2) {
						console.log("duo xuan ti jinru pand");
						that.jawap[0] = "";
						that.jawap[1] = "";
						that.jawap[2] = "";
						that.jawap[3] = "";
						that.answers = [];
						that.worngly = true;
						that.dbjawap = "";
						var jawap = arrjson.useranswer;
						var jawapjson = jawap.split(",");
						var jawaparrdb = arrjson.answer;

						//答案正确 ,
						let sane = 3;
						if (arrjson.option4 == "") {
							sane = 2;
						}

						if (jawaparrdb.indexOf("A") !== -1) {
							that.jawap[0] = "anschack 1";
						}
						if (jawaparrdb.indexOf("B") !== -1) {
							that.jawap[1] = "anschack 1";
						}
						if (jawaparrdb.indexOf("C") !== -1) {
							that.jawap[2] = "anschack 1";
						}
						if (sane == 3) {
							if (jawaparrdb.indexOf("D") !== -1) {
								that.jawap[3] = "anschack 1";
							}
						}
						let ashane = getArrEqual(jawaparrdb, jawapjson);
						console.log("(((((())))))", ashane);
						let arrload = getArrload(jawaparrdb, jawapjson);
						console.log("=======", arrload);
						console.log(jawaparrdb, jawapjson);
						if (arrload.length == 0) {
							console.log("全部正确");
						} else {
							console.log("部分正确");

							for (var i = 0; i < sane; i++) {
								if (jawapjson[i] == jawaparrdb[i]) {
									that.jawap[i] = "anschack 1";
								} else {
									that.jawap[i] = "wrong";
								}
							}
							for (var t = 0; t < jawapjson.length; t++) {
								if (jawaparrdb.indexOf(jawapjson[t]) == -1) {
									if (jawapjson[t] == "A") {
										that.jawap[0] = "wrong";
									}
									if (jawapjson[t] == "B") {
										that.jawap[1] = "wrong";
									}
									if (jawapjson[t] == "C") {
										that.jawap[2] = "wrong";
									}
									if (jawapjson[t] == "D") {
										that.jawap[3] = "wrong";
									}
								}
							}
						}

						//选择正确的
						if (ashane.indexOf("A") !== -1) {
							that.jawap[0] = "anschack";
						}
						if (ashane.indexOf("B") !== -1) {
							that.jawap[1] = "anschack";
						}
						if (ashane.indexOf("C") !== -1) {
							that.jawap[2] = "anschack";
						}
						if (sane == 3) {
							if (ashane.indexOf("D") !== -1) {
								that.jawap[3] = "anschack";
							}
						}
						//没有选择的
						if (arrload.indexOf("A") !== -1) {
							that.jawap[0] = "anschack 1";
						}
						if (arrload.indexOf("B") !== -1) {
							that.jawap[1] = "anschack 1";
						}
						if (arrload.indexOf("C") !== -1) {
							that.jawap[2] = "anschack 1";
						}
						if (sane == 3) {
							if (arrload.indexOf("D") !== -1) {
								that.jawap[3] = "anschack 1";
							}
						}

						console.log(that.jawap);

						that.dbjawap = arrjson.answer;
					}
				} else {
					//还没选择过
					that.jawap[0] = "";
					that.jawap[1] = "";
					that.jawap[2] = "";
					that.jawap[3] = "";
					that.answers = [];
					that.jawapjudge[0] = "";
					that.jawapjudge[1] = "";
					that.worngly = false;
					that.dbjawap = "";
				}

				that.subarr = arrjson;

				that.videoUrl =
					"https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/shipin/" + that.subarr
					.tid + "_sp.mp4"
				console.log("题目题目", that.subarr);
				uni.hideLoading();
				console.log(arrjson);
			},
			nextt(nus) {
				var that = this;

				that.musicShow = true;
				innerAudioContextbb.stop();

				var index = that.viewsindex + 1;
				console.log("//////////////////", index, that.datacount);
				if (index == that.datacount) {
					console.log("全部已看完");
					this.flag = 0;
					uni.showToast({
						title: "已经最后一道题",
						duration: 2000,
					});

					return false;
				}
				console.log("inde99999999----", index);


				// 注释8
				// // #ifdef APP-PLUS
				// var tid = that.subarrid[index].tid;

				// that.subjectarr(tid);
				// // #endif



				that.minidbid(index);

				that.viewsindex = index;
				// if (nus == 1) {
				// 	// #ifdef APP-PLUS
				// 	that.subjectarr(tid);
				// 	// #endif
				// 	// #ifdef MP-WEIXIN
				// 	that.minidbid(index);
				// 	// #endif
				// 	// setTimeout(function() {

				// 	// 	var tid = that.subarrid[index].tid;
				// 	// 	console.log("tid--=*******==" + tid);

				// 	// 	//that.tanru();

				// 	// 	setTimeout(function() {
				// 	// 		//that.viewsindex = index;
				// 	// 		that.tiimg = '';
				// 	// 		//that.subarr = {};

				// 	// 		// #ifdef APP-PLUS
				// 	// 		that.subjectarr(tid);
				// 	// 		// #endif
				// 	// 		// #ifdef MP-WEIXIN
				// 	// 		that.minidbid(index);
				// 	// 		// #endif

				// 	// 	}, 10)

				// 	// }, 10)
				// } else {
				// 	// #ifdef APP-PLUS
				// 	that.subjectarr(tid);
				// 	// #endif
				// 	// #ifdef MP-WEIXIN
				// 	that.minidbid(index);
				// 	// #endif
				// 	// setTimeout(function() {
				// 	// 	var tid = that.subarrid[index].tid;
				// 	// 	console.log("tid--=*******==" + tid);

				// 	// 	//that.tiimg = '../../static/logo.png';
				// 	// 	//that.tanru();

				// 	// 	setTimeout(function() {
				// 	// 		//that.viewsindex = index;
				// 	// 		// that.tiimg = '';
				// 	// 		// that.subarr = {};
				// 	// 		// #ifdef APP-PLUS
				// 	// 		that.subjectarr(tid);
				// 	// 		// #endif
				// 	// 		// #ifdef MP-WEIXIN
				// 	// 		that.minidbid(index);
				// 	// 		// #endif
				// 	// 	}, 10)

				// 	// }, 10)
				// }

				//console.log("that.subarrid++++++",that.subarrid);
				// var tid = that.subarrid[index].tid;
				// console.log("tid--=*******=="+tid);
				// that.tanru();

				// that.viewsindex = index;
				// that.tiimg = '';

				// that.subjectarr(tid);

				//存储记录
				// uni.setStorage({
				// 	key: that.subject + '_pracice_' + that.kemu,
				// 	data: index,
				// 	success: function() {
				// 		console.log('success');
				// 	}
				// });
			},

			privet(nus) {
				var that = this;

				that.musicShow = true;
				innerAudioContextbb.stop();

				if (that.viewsindex == 0) {
					console.log("第一题");
					this.flag = 0;
					uni.showToast({
						title: "这是第一道题",
						duration: 2000,
					});

					return false;
				}

				var index = that.viewsindex - 1;
				var tid = that.subarrid[index].tid;

				if (nus == 1) {

					// 注释9
					// // #ifdef APP-PLUS
					// that.viewsindex = index;
					// that.subjectarr(tid);
					// // #endif


					that.minidbid(index);
				} else {
					this.flag = 0;


					// 注释10
					// // #ifdef APP-PLUS
					// that.subjectarr(tid);
					// // #endif

					that.minidbid(index);
					that.viewsindex = index;
				}
			},

			onimgerr() {
				var that = this;
				that.subarr.timg = "";
			},
			settings: function() {
				console.log(this.show);
				if (this.show) {
					this.show = false;
				} else {
					this.show = true;
				}
			},

			sliderChange(e) {
				//设置字体大小
				console.log("value 发生变化：" + e.detail.value);
				var that = this;
				that.fontSize = e.detail.value;
				//保存字体大小
				uni.setStorage({
					key: "fontsize",
					data: e.detail.value,
					success: function() {
						console.log("success");
					},
				});
			},
			musicbar(e) {
				console.log("chufa = ", e);
				var that = this;
				that.musicchecked = e;
				//保存提示音
				uni.setStorage({
					key: "musicbars",
					data: e,
					success: function() {
						console.log("success");
					},
				});
			},
			vibrate(e) {
				var that = this;
				that.zhenchecked = e;
				//保存提示音
				uni.setStorage({
					key: "vibratebars",
					data: e,
					success: function() {
						console.log("success");
					},
				});
			},
			marknext(e) {
				var that = this;
				that.nextchecked = e;
				//保存自动跳转下一题
				uni.setStorage({
					key: "nextbars",
					data: e,
					success: function() {
						console.log("success");
					},
				});
			},
			titlebgcolor(bgcolors) {
				var that = this;
				if (bgcolors == true) {
					that.background.backgroundColor = "#2d2d2d";
					that.titlecolor = "#888888";
				} else {
					that.background.backgroundColor = "#ffffff";
					that.titlecolor = "#2d2d2d";
				}
			},
			colour: function(num) {
				console.log(num);
				var that = this;
				var colors;
				if (num == 0) {
					that.colorStyle = true;
					colors = true;
					that.titlecolor = "#888888";
				} else {
					that.colorStyle = false;
					colors = false;
					that.titlecolor = "#2d2d2d";
				}
				uni.setStorage({
					key: "colorStyle",
					data: colors,
					success: function() {
						console.log("success");
						that.titlebgcolor(colors);
					},
				});
			},
			handletouchstart: function(event) {
				//this.lastX = event.changedTouches[0].pageX;
				this.lastXX = event.changedTouches[0].pageX;

				// this.startData.clientX = e.changedTouches[0].clientX;   //手指按下时的X坐标
				// this.startData.clientY = e.changedTouches[0].clientY;   //手指按下时的Y坐标
			},
			handletouchend: function(event) {
				var that = this;
				//停止滑动
				console.log("2222222222222222222222222222");
				console.log(event.changedTouches[0].pageX);
				console.log(this.lastXX, this.lastX, event.changedTouches[0].pageX);
				console.log("xxxx=", Math.abs(this.lastXX - event.changedTouches[0].pageX));
				console.log(this.flag);
				if (Math.abs(this.lastXX - event.changedTouches[0].pageX) > 80) {
					//在事件结束时，判断滑动的距离是否达到出发需要执行事件的要求
					console.log("执行查看跳转事件");
					if (this.flag !== 0) {
						return;
					}
					if (this.lastXX - this.lastX > 0) {
						console.log("向左滑动");
						this.flag = 1;
						that.nextt(1);
					} else {
						console.log("向右滑动");
						this.flag = 2;
						that.privet(1);
					}
				} else {
					console.log("滑动距离不够，不执行跳转");
				}
			},
			handletouchmove: function(event) {
				if (this.flag !== 0) {
					return;
				}
				setTimeout(function() {
					this.flag = 0;
				}, 50);

				let currentX = event.changedTouches[0].pageX;
				let currentY = event.changedTouches[0].pageY;
				let tx = currentX - this.lastX;
				let ty = currentY - this.lastY;

				var that = this;
				var txnum = 0;
				console.log("1111111111111111111111");
				//左右方向滑动
				// if (Math.abs(tx) > Math.abs(ty)) {

				// 	if (tx < 0) {
				// 		// 向左滑动
				// 		this.flag = 1;

				// 	} else if (tx > 0) {
				// 		//向右滑动
				// 		this.flag = 2;

				// 	}
				// }
				console.log(this.flag);
				//上下方向滑动
				// else {
				//     if (ty < 0) {
				//         //向上滑动
				//         this.flag = 3;
				//     } else if (ty > 0) {
				//         //向下滑动
				//         this.flag = 4;
				//     }
				// }

				//将当前坐标进行保存以进行下一次计算
				this.lastX = currentX;
				this.lastY = currentY;
			},
			tanru() {
				var that = this;
				that.jin = true;
				that.classz = "tanchuz";
				console.log("tanru");
				setTimeout(function() {
					that.jin = false;
				}, 500);
			},
			tanchu() {
				var that = this;
				that.jin = true;
				that.classz = "tanchu";
				console.log("tanchu");
				setTimeout(function() {
					that.jin = false;
				}, 500);
			},

		},
	};
	//https://ext.dcloud.net.cn/plugin?id=3456  单选多选使用
</script>

<style scoped lang="scss">
	.videoimg {
		width: 690rpx;
		height: 388rpx;
		position: relative;
		margin-top: 30rpx;

		.videocount {
			height: 50rpx;
			display: inline-block;
			color: #ffffff;
			position: absolute;
			bottom: -10rpx;
			right: 5rpx;
		}


	}

	.videoimg image {
		width: 690rpx;
		height: 388rpx;
		border-radius: 20rpx;
		border: solid 1rpx #20231D;
		position: absolute;
	}

	.viewvideo {
		width: 690rpx;
		height: 420rpx;
		position: relative;
		margin-top: 31rpx;
	}

	.videoc {
		width: 690rpx;
		height: 420rpx;
	}

	page {
		height: 100%;
		background-color: #f6f6f6;
	}

	image {
		height: auto;
	}

	.scroll-Ys {
		height: calc(100vh - 88rpx - 200rpx);
		// height: 1320rpx;
	}

	.kzlayout {
		direction: rtl;
		text-align: right;
	}

	.clearfloat {
		clear: both;
		height: 0;
		font-size: 1px;
		line-height: 0px;
	}

	.mheight {
		display: block;
		// height: calc(100vh - 70px - 220rpx);
	}

	.csimg {
		vertical-align: middle;
		padding-top: 12rpx;
	}

	.colles {
		width: 40rpx;
		margin: 0rpx auto 0 auto;
	}

	.nodeheight {
		line-height: 200% !important;
	}

	.nodeheight div {
		line-height: 200% !important;
	}

	.nodeheight p {
		line-height: 200% !important;
	}

	* {
		touch-action: auto;
	}

	.queding {
		width: 700rpx;
		padding: 20rpx 0rpx;
		margin: 0 auto;
	}

	.duoqueding {
		width: 500rpx;
		margin: 0 auto;
		background: #0da0ff;
		color: #ffffff;
		border-radius: 50rpx;
	}

	.abdborder {
		border: 5rpx solid #0da0ff;
	}

	.timg {
		width: 700rpx;
		height: 350rpx;
		margin: 0 auto 20rpx auto;
		/* padding-bottom: 20rpx; */
	}

	.timg image {
		width: 700rpx;
		height: 325rpx;
		margin: 0 auto;
		padding: 20rpx 0rpx;
	}

	.kz .answerselect {
		margin-top: -9rpx;
		margin-left: 30rpx;
	}

	.uy .answerselect {
		margin-top: -9rpx;
		margin-left: 30rpx;
	}

	.grenntext {
		color: #0bd34e;
	}

	.txtalign {
		text-align: justify;
		vertical-align: top;
	}

	/* #ifdef MP-WEIXIN */
	.u-navbar-content-title {
		left: 80rpx !important;
	}

	.settingfoot button::after {
		border: none;
	}

	.settingfoot button {
		border: 1rpx solid #eeeeee;
	}

	/* #endif */
	.carttitle {
		display: flex;
		flex-direction: row;
		align-items: center;
		text-align: center;
		justify-content: space-between;
		width: 750rpx;
		height: 80rpx;
		background: #f8f8f8;
	}

	.carttitleview {
		width: 250rpx;
		display: inline-block;
	}

	.cartcon {
		width: 750rpx;
		height: 620rpx;
		/* overflow-y: auto; */
		position: relative;
	}

	.scroll-Y {
		height: 620rpx;
	}

	.cartconview {
		display: flex;
		flex-direction: row;
		align-items: center;
		text-align: center;
		flex-wrap: wrap;
		justify-content: space-between;
		background-color: #ffffff;
	}

	.cartconnum {
		width: 80rpx;
		height: 80rpx;
		border-radius: 50%;
		text-align: center;
		line-height: 80rpx;
		display: inline-block;
		border: 1px solid #bbbbbb;
		margin: 15rpx;
	}

	.kz .cartconnum {
		line-height: 95rpx;
	}

	.uy .cartconnum {
		line-height: 95rpx;
	}

	.cartpink {
		background: #fed4d5;
		color: #db7d7b;
		border: none;
	}

	.cartblue {
		background: #bee3fe;
		color: #4f86af;
		border: none;
	}

	.cartaction {
		border: solid 1rpx #4f86af;
		color: #4f86af;
	}

	.pl-20 {
		padding-left: 20rpx;
	}

	.pl-10 {
		padding-left: 10rpx;
	}

	.pb50 {
		padding-bottom: 50rpx;
	}

	.black {
		background: #2d2d2d;
		height: 100%;
		display: block;
		overflow: hidden;
		overflow-y: auto;
		position: relative;
	}

	.black .answerabcd {
		background: #ffffff;
		// box-shadow: 4px #e6e6e6;
	}

	.black .popup {
		color: #2d2d2d;
	}

	.white {
		background: #ffffff;
		height: 100%;
		display: block;
		overflow: hidden;
		overflow-y: auto;
		position: relative;
	}

	.white .answerabcd {
		background: #f3f4f6;
		// box-shadow: 4px #e3e3e3;
	}

	.pt-10 {
		padding-top: 10rpx;
	}

	.marfoot {
		width: 750rpx;
		height: 130rpx;
		position: fixed;
		left: 0rpx;
		bottom: 0rpx;
		background-color: white;
		z-index: 999;
	}

	.markfoot {
		width: 750rpx;
		height: 130rpx;
		line-height: 130rpx;
		// box-shadow: -5rpx 0px 5px #F7F7F7;
		position: fixed;
		left: 0rpx;
		bottom: 0rpx;
		padding: 30rpx;
		display: flex;
		box-sizing: border-box;

		flex-direction: row;
		align-items: center;
		text-align: center;
		justify-content: space-between;

		.markfoot-last {
			display: flex;
			align-items: center;

			.last-text {
				font-size: 26rpx;
				// font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				// color: #2B2B2B;
			}

			.last-img {
				width: 26rpx;
				height: 26rpx;
				margin-left: 10rpx;
			}
		}

		.markfoot-right {
			width: 40rpx;
			height: 70rpx;
			display: flex;
			flex-direction: column;
			align-items: center;

			.right-text {
				font-size: 24rpx;
				// font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				// color: #2B2B2B;
				line-height: 40rpx;
			}

			.right-img {
				width: 30rpx;
				height: 30rpx;
			}
		}

		.markfoot-jiangjie {
			margin-top: -30rpx;
			display: flex;
			flex-direction: column;
			align-items: center;

			.jiangjie-text {
				font-size: 24rpx;
				// font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				// color: #2B2B2B;
				line-height: 28rpx;
				margin-top: 8rpx;
			}

			.jiangjie-img {
				width: 82rpx;
				height: 82rpx;
				margin-top: -38rpx;
				// margin-left: 10rpx;
			}
		}

		.next {
			.last-img {
				margin-left: 10rpx;
			}
		}
	}

	.white .markfoot {
		background: #fefffd;
	}

	.black .markfoot {
		background: #20231d;
	}

	.markfootview {
		display: inline-block;
	}

	.pl-15 {
		padding-left: 15rpx;
	}

	.pr-15 {
		padding-right: 15rpx;
	}

	.answercol {
		width: 700rpx;
		padding: 10rpx 0rpx;
		border-radius: 5rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		text-align: center;
		justify-content: space-between;
		border-bottom: 1px solid rgba(0, 0, 0, 0.5);
	}

	.white .answercol {
		background: #f6f7f6;
	}

	.black .answercol {
		background: #20231d;
	}

	.answerow {
		width: 200rpx;
		display: inline-block;
	}

	.answerclear {
		width: 300rpx;
		display: inline-block;
	}

	.answermark {
		width: 700rpx;
		margin: 10rpx auto;
		padding-bottom: 130rpx;
	}

	.answermarktitle {
		width: 700rpx;
		padding: 5rpx 0rpx;
	}

	.answermarkcon {
		padding: 5rpx 0rpx;
	}

	.bluemark {
		color: #3185c4;
	}

	.pinkmark {
		color: #e81242;
	}

	.answer {
		margin: 25rpx 0;
	}

	.answers {
		display: flex;
		flex-direction: row;
		align-items: flex-start;
		justify-content: left;
		vertical-align: middle;
		padding: 25rpx 0rpx;
	}

	.kz .answers {
		justify-content: right;
	}

	.uy .answers {
		justify-content: right;
	}

	.answerselect {
		display: inline-block;
		align-items: flex-start;
	}

	.answerstext {
		display: inline-block;
		align-items: flex-start;
		padding-left: 36rpx;
		text-align: justify;
	}

	.kz .answerstext {
		padding-left: 0rpx !important;
		padding-right: 10rpx;
	}

	.uy .answerstext {
		padding-left: 0rpx !important;
		padding-right: 10rpx;
	}

	.answerabcd {
		border-radius: 50%;
		text-align: center;
		font-size: 35rpx;
		// box-shadow: 3rpx 3rpx 3rpx #848584;
		// line-height: 23px;
		font-size: 28rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #4b4b4b;
		line-height: 46rpx;
	}

	.anschack .answerabcd {
		background: #0da0ff;
		color: #ffffff;
	}

	.anschack .answerstext {
		color: #0da0ff;
	}

	.wrong .answerabcd {
		background: #ff0000;
		color: #ffffff;
		border: 5rpx solid #ff0000;
	}

	.wrong .answerstext {
		color: #ff0000;
	}

	.topic {
		width: 750rpx;
		margin: 0 auto;
		display: block;
		// padding-top: 30rpx;
		position: relative;
	}

	.topiccon {
		display: block;
		padding: 2rpx 5rpx;
		text-align: justify !important;
		// background-color: #ffffff;
		box-sizing: border-box;

		// padding: 0 30rpx;
		.bgback {
			background-color: #2d2d2d;
		}

		.topiccon-box {
			width: 100%;
			// background-color: #ffffff;
			padding: 30rpx;

			.topicnum-clear {
				width: 100%;
				height: 60rpx;
				padding: 5rpx 30rpx;
				box-sizing: border-box;
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-bottom: 30rpx;

				.topicnum {
					font-size: 35rpx;
					// font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					line-height: 41rpx;
					color: #828282;

					.topicnum-blue {
						color: #0da0ff;
					}
				}

				.clear {
					width: 194rpx;
					height: 50rpx;
					background-color: #f0f0f0;
					font-size: 26rpx;
					// font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #828282;
					line-height: 50rpx;
					text-align: center;
					border-radius: 40rpx;
				}
			}

			.question-class {
				display: inline-block;
				// display: flex;
				text-align: justify !important;

				.question-class-text {
					width: 136rpx;
					height: 44rpx;
					background: #0da0ff;
					border-radius: 12rpx 12rpx 12rpx 12rpx;
					opacity: 1;
					font-size: 26rpx;
					// font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #ffffff;
					line-height: 42rpx;
					text-align: center;
					margin-right: 20rpx;
					display: inline-block;
				}

				.ku-question-class-text {
					height: 44rpx;
					background: #0da0ff;
					border-radius: 12rpx 12rpx 12rpx 12rpx;
					opacity: 1;
					font-size: 26rpx;
					// font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #ffffff;
					line-height: 44rpx;
					text-align: center;
					margin-left: 20rpx;
					display: inline-block;
					padding: 0 20rpx;
				}
			}

			.collect-listen-read {
				width: 650rpx;
				height: 110rpx;
				margin: 0 auto;
				margin-top: 60rpx;
				display: flex;
				justify-content: space-between;
				direction: ltr;


				.collect {
					// width: 90rpx;
					// height: 90rpx;
					width: 33.33%;
					display: flex;
					flex-direction: column;
					justify-content: space-between;
					align-items: center;

					.collect-img {
						width: 50rpx;
						height: 50rpx;
					}

					.collect-text {
						// font-size: 28rpx;
						// font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
						// color: #2B2B2B;
						// line-height: 33rpx;
					}
				}
			}

			.answer-correction {
				width: 690rpx;
				height: 84rpx;
				background: #f6f6f6;
				border-radius: 20rpx 20rpx 20rpx 20rpx;
				opacity: 1;
				margin-top: 75rpx;
				display: flex;
				justify-content: space-between;
				padding: 0 30rpx;
				// margin-bottom: 30rpx;

				.answer {
					font-size: 30rpx;
					// font-family: PingFang SC-Medium, PingFang SC;
					font-weight: 500;
					color: #2b2b2b;

					// line-height: 84rpx;
					.answer-blue {
						font-size: 36rpx;
						// font-family: PingFang SC-Medium, PingFang SC;
						font-weight: 500;
						color: #0da0ff;
					}
				}

				.correction {
					font-size: 24rpx;
					// font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #c2c2c2;
					line-height: 84rpx;
				}
			}
		}

		.Problem-technique {
			width: 100%;
			// margin-top: 30rpx;
			// background-color: #ffffff;
			padding: 30rpx;
			padding-top: 0;
			margin-top: 10rpx;

			.Problem-title {
				// font-size: 34rpx;
				// font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				// color: #2B2B2B;
				line-height: 40rpx;

				.shu {
					display: inline-block;
					width: 6rpx;
					height: 28rpx;
					background-color: #0da0ff;
					margin-right: 18rpx;
					border-radius: 10rpx;
				}
			}

			.technique {
				// font-size: 28rpx;
				// font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				// color: #2B2B2B;
				line-height: 46rpx;
				margin-top: 28rpx;
			}
		}
	}

	.zeng {
		width: 100%;
		height: 50rpx;
		background-color: pink;
	}

	.topictype {
		background: #1894f4;
		padding: 0rpx 10rpx;
		float: left;
	}

	.toppicplay {
		width: 40rpx;
		height: 40rpx;
		margin-left: 10rpx;
		margin-right: 15rpx;
		float: left;
	}

	.toppicplay image {
		width: 40rpx;
		height: 40rpx;
	}

	.topictext {
		padding: 2rpx 5rpx;
		float: left;
		display: block;
	}

	.cnlayout .topictype {
		margin-top: 10rpx;
	}

	.cnlayout .toppicplay {
		margin-top: 10rpx;
	}

	.kzlayout .topictype {
		float: right !important;
	}

	.kzlayout .toppicplay {
		float: right !important;
	}

	.uylayout .topictype {
		float: right !important;
	}

	.uylayout .toppicplay {
		float: right !important;
	}

	.clearfloat {
		clear: both;
		height: 0;
		font-size: 1px;
		line-height: 0px;
	}

	.poptitle {
		width: 750rpx;
		height: 80rpx;
		line-height: 80rpx;
		text-indent: 30rpx;
	}

	.settingtitle {
		width: 700rpx;
		height: 80rpx;
		margin: 0 auto;
		border-bottom: solid 2rpx #dedfde;
	}

	.booter-bottom {
		border-bottom: solid 1rpx #e4e4e4;
		padding-bottom: 20rpx;
		box-sizing: border-box;
	}

	.setting-fontsize-text {
		width: 100%;
		// padding-left: 30rpx;
		box-sizing: border-box;
		font-size: 32rpx;
		// font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #2b2b2b;
		// margin-left: 30rpx;
	}

	.setting-yx-text {
		font-size: 32rpx;
		// font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #2b2b2b;
		// line-height: 38rpx;
	}

	.setting-yx {
		width: 700rpx;
		margin-left: 25rpx;
		// padding: 0 30rpx;
	}

	.settingcon {
		width: 700rpx;
		margin: 30rpx auto;
		display: flex;
		justify-items: baseline;
		justify-content: space-between;
	}

	.pt50 {
		padding-top: 50rpx;
	}

	.settingcontxt {
		width: 600rpx;
		height: 80rpx;
		display: inline-block;
	}

	.settingswith {
		width: 100rpx;
		height: 80rpx;
		display: inline-block;
	}

	.settingfoot {
		width: 700rpx;
		margin: 0 auto;
		display: flex;
		flex-direction: row;
		align-items: center;
		text-align: center;
	}

	.settingfoottext {
		justify-items: left;
		padding: 0 15rpx;
		height: 60rpx;
		line-height: 60rpx;
	}

	.settingfootbu {
		height: 60rpx;
		line-height: 60rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		text-align: center;
		justify-content: center;
	}

	.blacks {
		background: #696a7c;
		height: 100%;
		display: block;
		overflow: hidden;
		overflow-y: auto;
		position: relative;
		color: #ffffff;
	}

	.kz .settingfootbu text {
		line-height: 70rpx !important;
		height: 60rpx !important;
	}

	.uy .settingfootbu text {
		line-height: 70rpx !important;
		height: 60rpx !important;
	}

	.settingfootbu text {
		display: inline-block;
		line-height: 60rpx;
	}

	.settingfootbutext {
		display: inline-block;
		line-height: 60rpx;
	}

	.settingfootbu image {
		display: inline-block;
		width: 40rpx;
		height: 40rpx;
		justify-content: center;
	}

	.white {
		background: #fcfdfc;
		color: #3c3d3c;
	}

	.black {
		background: #2d2d2d;
		color: #888888;
	}

	.cololdrak {
		color: #888888;
	}

	.fontsizes {
		width: 750rpx;
		height: 80rpx;
		position: relative;
		display: flex;
		align-items: center;
		justify-items: baseline;
	}

	.fontsizeleft {
		width: 70rpx;
		height: 70rpx;
		display: inline-block;
		line-height: 70rpx;
		text-align: center;
	}

	.fontsizebg {
		width: 550rpx;
		height: 34rpx;

		display: inline-block;
		background: url(../../static/images/fontsize.png) no-repeat;
		background-size: 100% auto;
		justify-content: center;
		margin-top: 0rpx;
	}

	.fontslider {
		margin-top: -7rpx;
		width: 100%;
		margin-left: 0rpx;
	}

	.settingimg {
		width: 40rpx;
		height: 40rpx;
	}

	.wrap {
		padding: 24rpx;
	}

	.navbar-right {
		margin-right: 24rpx;
		display: flex;
		align-items: flex-end;
		right: 10rpx;
		position: absolute;
	}

	.slot-wrap {
		display: flex;
		align-items: center;
		flex: 1;
		position: relative;
	}

	.right-item {
		margin: 0 12rpx;
		position: relative;
		color: #ffffff;
		display: flex;
	}

	.message-box {
		width: 40rpx;
		height: 40rpx;
	}

	/* 动画特效开始 */
	.tanchu {
		/* Chrome, Safari, Opera */
		-webkit-animation-name: moveit;
		-webkit-animation-duration: 0.5s;
		/* Standard syntax */
		animation-name: moveit;
		animation-duration: 0.5s;
	}

	.tanchuz {
		/* Chrome, Safari, Opera */
		-webkit-animation-name: moveitz;
		-webkit-animation-duration: 0.5s;
		/* Standard syntax */
		animation-name: moveitz;
		animation-duration: 0.5s;
	}

	/* Chrome, Safari, Opera */
	@-webkit-keyframes moveitz {
		from {
			left: 0;
		}

		to {
			left: -150%;
			opacity: 0;
		}
	}

	/* Standard syntax */
	@keyframes moveitz {
		from {
			left: 0;
		}

		to {
			left: -150%;
			opacity: 0;
		}
	}

	/* Chrome, Safari, Opera */
	@-webkit-keyframes moveit {
		from {
			left: 0;
		}

		to {
			left: 150%;
			opacity: 0;
		}
	}

	/* Standard syntax */
	@keyframes moveit {
		from {
			left: 0;
		}

		to {
			left: 150%;
			opacity: 0;
		}
	}

	/* 动画特效结束 */
	/* 隐形显示id */
	.viewid {
		color: #b3b3b3;
		font-size: 20rpx;
	}

	/* 隐形显示id结束 */

	.bos100 {
		width: 750rpx;
		height: 100rpx;
	}

	.uni-system-preview-image {
		background-color: transparent;
	}

	.lineheihtnocn {
		line-height: 67rpx;
	}

	.imgpop {
		background-color: transparent;

		/deep/.u-mode-center-box {
			background-color: transparent;
		}
	}
</style>